public class GuavaRateLimiter extends Object implements RateLimiter
Constructor and Description |
---|
GuavaRateLimiter(long initialRate)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
acquire(long permits)
Sleep until the specified number of queries are available.
|
long |
getRate()
Get current QPS of the rate limiter, with a nonpositive rate indicating no limit.
|
void |
setRate(long newRate)
Change the rate at which permits are made available.
|
public GuavaRateLimiter(long initialRate)
initialRate
- Count of permits which should be made available per second. A nonpositive rate is
taken to indicate there should be no limitation on rate.public long getRate()
RateLimiter
getRate
in interface RateLimiter
public void setRate(long newRate)
newRate
- Count of permits which should be made available per second. A nonpositive rate is
taken to indicate that there should be no limitation on rate.public void acquire(long permits)
RateLimiter
acquire
in interface RateLimiter
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.