}
}
}
}
int result = ACCESS_DENIED;
LazyLeakyBucket bucket = null;
T key = keyFactory.create(SecurityContextHolder.getContext());
try {
bucket = objectPool.borrowObject(key);
if (bucket.add(amount)) {
result = ACCESS_GRANTED;
}
} catch (IllegalArgumentException iae) {
// this should never occur since amount is minimum zero (Math.max)
LOGGER.error(String.format("Illegal amount of tokens added to bucket: %s", amount),iae);