@InterfaceAudience.Private @InterfaceStability.Evolving public class AverageIntervalRateLimiter extends RateLimiter
QUOTA_RATE_LIMITER_CONF_KEY
Constructor and Description |
---|
AverageIntervalRateLimiter() |
Modifier and Type | Method and Description |
---|---|
long |
getNextRefillTime() |
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) |
canExecute, canExecute, consume, consume, getAvailable, getLimit, getTimeUnitInMillis, isBypass, set, toString, update, waitInterval, waitInterval
public long refill(long limit)
RateLimiter
limit
- Maximum available resource units that can be refilled to.public long getWaitInterval(long limit, long available, long amount)
RateLimiter
limit
- Maximum available resource units that can be refilled to.available
- Currently available resource unitsamount
- Resources for which time interval to calculate forpublic void setNextRefillTime(long nextRefillTime)
setNextRefillTime
in class RateLimiter
public long getNextRefillTime()
getNextRefillTime
in class RateLimiter