synchronized (lock) {
lockedSet.add(bucketID);
GatewayRate gr = gatewayRateValidator.getRateForBucket(bucketID, limit, mustResetRateLimit);
gatewayRateValidator.updateRateLimitAndQuotaValues(gr, limit, currentTime);
params.gr = gr;
params.limit = limit;
params.callDescriptor = callDescriptor;
gatewayRateValidator.checkRateLimitAndQuota(apiCallStatus, params);
this.gdm.releaseLockForBucket(bucketID, lock);
lockedSet.remove(bucketID);
}
}
}
// TODO: maybe increment always in previous loop and decrement all gr only if call was failed
// step2: save data for call success or fail
it = authIdentity.getCallDescriptors().iterator();
while (it.hasNext())
{
CallDescriptor callDescriptor = it.next();
Integer bucketID = callDescriptor.getBucketId();
Integer contextId = callDescriptor.getContextId();
this.dataManager.fillLimitsById(contextId, limit);
if ((limit.getQuotaPerDay()!=null) || (limit.getQuotaPerWeek()!=null) || (limit.getQuotaPerMonth()!=null)
|| (limit.getRateLimitPerMinute()!=null) || (limit.getRateLimitPerSecond()!=null))
{
LockCounter lock = this.gdm.getLockForBucket(bucketID);
synchronized (lock) {
GatewayRate gr = gatewayRateValidator.getRateForBucket(bucketID);
GatewayQueueRate gqr = gatewayRateValidator.getQueueRateForBucket(bucketID);
if (apiCallStatus.apiCallIsSuccess)
{
gr.localApiCallsSinceOneMinute++;