Class AverageIntervalRateLimiter

java.lang.Object
org.apache.hadoop.hbase.quotas.RateLimiter
org.apache.hadoop.hbase.quotas.AverageIntervalRateLimiter

@Private @Evolving public class AverageIntervalRateLimiter extends RateLimiter
This limiter will refill resources at every TimeUnit/resources interval. For example: For a limiter configured with 10resources/second, then 1 resource will be refilled after every 100ms (1sec/10resources)
  • Field Details

  • Constructor Details

  • Method Details

    • refill

      public long refill(long limit)
      Description copied from class: RateLimiter
      Refill the available units w.r.t the elapsed time.
      Specified by:
      refill in class RateLimiter
      Parameters:
      limit - Maximum available resource units that can be refilled to.
      Returns:
      how many resource units may be refilled ?
    • getWaitInterval

      public long getWaitInterval(long limit, long available, long amount)
      Description copied from class: RateLimiter
      Time in milliseconds to wait for before requesting to consume 'amount' resource.
      Specified by:
      getWaitInterval in class RateLimiter
      Parameters:
      limit - Maximum available resource units that can be refilled to.
      available - Currently available resource units
      amount - Resources for which time interval to calculate for
      Returns:
      estimate of the ms required to wait before being able to provide 'amount' resources.
    • setNextRefillTime

      public void setNextRefillTime(long nextRefillTime)
      Specified by:
      setNextRefillTime in class RateLimiter
    • getNextRefillTime

      public long getNextRefillTime()
      Specified by:
      getNextRefillTime in class RateLimiter