Class GuavaRateLimiter
- java.lang.Object
-
- org.apache.accumulo.core.util.ratelimit.GuavaRateLimiter
-
- All Implemented Interfaces:
RateLimiter
- Direct Known Subclasses:
SharedRateLimiterFactory.SharedRateLimiter
public class GuavaRateLimiter extends Object implements RateLimiter
Rate limiter from the Guava library.
-
-
Constructor Summary
Constructors Constructor Description GuavaRateLimiter(long initialRate)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquire(long permits)Sleep until the specified number of queries are available.longgetRate()Get current QPS of the rate limiter, with a non-positive rate indicating no limit.voidsetRate(long newRate)Change the rate at which permits are made available.
-
-
-
Method Detail
-
getRate
public long getRate()
Description copied from interface:RateLimiterGet current QPS of the rate limiter, with a non-positive rate indicating no limit.- Specified by:
getRatein interfaceRateLimiter
-
setRate
public void setRate(long newRate)
Change the rate at which permits are made available.- Parameters:
newRate- Count of permits which should be made available per second. A non-positive rate is taken to indicate that there should be no limitation on rate.
-
acquire
public void acquire(long permits)
Description copied from interface:RateLimiterSleep until the specified number of queries are available.- Specified by:
acquirein interfaceRateLimiter
-
-