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
Fields inherited from class org.apache.hadoop.hbase.quotas.RateLimiter
DEFAULT_TIME_UNIT, QUOTA_RATE_LIMITER_CONF_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
long
getWaitInterval
(long limit, long available, long amount) Time in milliseconds to wait for before requesting to consume 'amount' resource.long
refill
(long limit) Refill the available units w.r.t the elapsed time.void
setNextRefillTime
(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:RateLimiter
Refill the available units w.r.t the elapsed time.- Specified by:
refill
in 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:RateLimiter
Time in milliseconds to wait for before requesting to consume 'amount' resource.- Specified by:
getWaitInterval
in 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:
setNextRefillTime
in classRateLimiter
-
getNextRefillTime
- Specified by:
getNextRefillTime
in classRateLimiter
-