Examples of GatewayQueueRate


Examples of com.alu.e3.rate.model.GatewayQueueRate

          GatewayRate gr =  gatewayRateValidator.getRateForBucket(oldestCall.bucketID);
          gr.localApiCallsSinceOneMinute--;
          if (!oldestCall.countedInLastPeriodMinute) {
            // if the call was after the last collect and older than 1 minute
            // then we must count it
            GatewayQueueRate gqr = gatewayRateValidator.getQueueRateForBucket(oldestCall.bucketID);
            gqr.localApiCallsInLastPeriodMinute++;
          }
          this.gdm.releaseLockForBucket(oldestCall.bucketID, lock);
        }
      }
    } 

    // update this.apiCallsPerSecondQueue to remove call older than 1s
    removed = true;
    while (removed) { 
      removed = false;
      synchronized(lockUpdateSecondQueues) {
        oldestCall = this.gdm.peekCallFromSecondQueue();
        if  ((oldestCall!=null) && (currentTime - oldestCall.callTime > 1000)) {
          removed = this.gdm.removeCallFromSecondQueue(oldestCall);
        }
      }
      if (removed && oldestCall.callSuccess) {
        LockCounter lock = this.gdm.getLockForBucket(oldestCall.bucketID);

        synchronized (lock) {
          GatewayRate gr =  gatewayRateValidator.getRateForBucket(oldestCall.bucketID);
          gr.localApiCallsSinceOneSecond--;
          if (!oldestCall.countedInLastPeriodSecond) {
            // if the call was after the last collect and older than 1 second
            // then we must count it
            GatewayQueueRate gqr = gatewayRateValidator.getQueueRateForBucket(oldestCall.bucketID);
            gqr.localApiCallsInLastPeriodSecond++;
          }
          this.gdm.releaseLockForBucket(oldestCall.bucketID, lock);
        }
      }
View Full Code Here

Examples of com.alu.e3.rate.model.GatewayQueueRate

          LockCounter lock = this.gdm.getLockForBucket(bucketID);

          synchronized (lock) {
           
            GatewayRate gr = gatewayRateValidator.getRateForBucket(bucketID);
            GatewayQueueRate gqr = gatewayRateValidator.getQueueRateForBucket(bucketID);     
 
            if (apiCallStatus.apiCallIsSuccess)
            {
              gr.localApiCallsSinceOneMinute++;
              gr.localApiCallsSinceOneSecond++;
View Full Code Here

Examples of com.alu.e3.rate.model.GatewayQueueRate

    return gr;
  }

  @Override
  public GatewayQueueRate getQueueRateForBucket(Integer bucketID) {
    GatewayQueueRate gqr = this.gdm.getFromQueueRateMap(bucketID);     

    if (gqr == null) {
      gqr = new GatewayQueueRate(bucketID);
      this.gdm.putInQueueRateMap(gqr.bucketID, gqr);
    }
   
    return gqr;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.