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 void
acquire(long numPermits)
Sleep until the specified number of queries are available.long
getRate()
Get current QPS of the rate limiter, with a non-positive rate indicating no limit.void
setRate(long newRate)
Change the rate at which permits are made available.
-
-
-
Method Detail
-
getRate
public long getRate()
Description copied from interface:RateLimiter
Get current QPS of the rate limiter, with a non-positive rate indicating no limit.- Specified by:
getRate
in 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 numPermits)
Description copied from interface:RateLimiter
Sleep until the specified number of queries are available.- Specified by:
acquire
in interfaceRateLimiter
-
-