public final class DependantRateLimiter extends RateLimiter
| Constructor and Description |
|---|
DependantRateLimiter(IRateLimiter dependant,
int requests,
int milliseconds)
Constructs a new RateLimiter.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getMillisecondsBetweenLocks() |
boolean |
lock()
Call this BEFORE executing code that needs to be rate limited.
|
void |
unlock()
Call this AFTER executing code that needs to be rate limited.
|
public DependantRateLimiter(IRateLimiter dependant, int requests, int milliseconds)
requests - the x in 'x requests per y millisecondsmilliseconds - the y in 'x requests per y millisecondsdependant - the rate limiter this one is dependant onpublic boolean lock()
IRateLimiterlock in interface IRateLimiterlock in class RateLimiterpublic void unlock()
IRateLimiterunlock in interface IRateLimiterunlock in class RateLimiterpublic int getMillisecondsBetweenLocks()
getMillisecondsBetweenLocks in interface IRateLimitergetMillisecondsBetweenLocks in class RateLimiterCopyright © 2017. All rights reserved.