@InterfaceAudience.Private @InterfaceStability.Evolving public class AverageIntervalRateLimiter extends RateLimiter
Modifier and Type | Field and Description |
---|---|
private long |
nextRefillTime |
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
private long nextRefillTime
public AverageIntervalRateLimiter()
public long refill(long limit)
RateLimiter
refill
in class RateLimiter
limit
- Maximum available resource units that can be refilled to.public long getWaitInterval(long limit, long available, long amount)
RateLimiter
getWaitInterval
in class 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
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.