Package org.apache.hadoop.hbase.quotas
Class AverageIntervalRateLimiter
java.lang.Object
org.apache.hadoop.hbase.quotas.RateLimiter
org.apache.hadoop.hbase.quotas.AverageIntervalRateLimiter
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 Summary
FieldsFields inherited from class org.apache.hadoop.hbase.quotas.RateLimiter
DEFAULT_TIME_UNIT, QUOTA_RATE_LIMITER_CONF_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonglonggetWaitInterval(long limit, long available, long amount) Time in milliseconds to wait for before requesting to consume 'amount' resource.longrefill(long limit) Refill the available units w.r.t the elapsed time.voidsetNextRefillTime(long nextRefillTime) Methods inherited from class org.apache.hadoop.hbase.quotas.RateLimiter
consume, consume, getAvailable, getLimit, getTimeUnitInMillis, getWaitIntervalMs, getWaitIntervalMs, isAvailable, isBypass, set, toString, update, waitInterval, waitInterval
-
Field Details
-
nextRefillTime
-
-
Constructor Details
-
AverageIntervalRateLimiter
public AverageIntervalRateLimiter()
-
-
Method Details
-
refill
Description copied from class:RateLimiterRefill the available units w.r.t the elapsed time.- Specified by:
refillin classRateLimiter- Parameters:
limit- Maximum available resource units that can be refilled to.- Returns:
- how many resource units may be refilled ?
-
getWaitInterval
Description copied from class:RateLimiterTime in milliseconds to wait for before requesting to consume 'amount' resource.- Specified by:
getWaitIntervalin classRateLimiter- Parameters:
limit- Maximum available resource units that can be refilled to.available- Currently available resource unitsamount- Resources for which time interval to calculate for- Returns:
- estimate of the ms required to wait before being able to provide 'amount' resources.
-
setNextRefillTime
- Specified by:
setNextRefillTimein classRateLimiter
-
getNextRefillTime
- Specified by:
getNextRefillTimein classRateLimiter
-