public class RateLimiter extends Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
index
The current index in the round buffer, starting at 0.
|
protected static Logger |
logger
The logger for this object.
|
protected long |
milliseconds
The y in 'x requests per y milliseconds'.
|
protected long[] |
roundBuffer
The round buffer we're using, with length set to x in 'x requests per y milliseconds.
|
| Constructor and Description |
|---|
RateLimiter(int requests,
int milliseconds)
Constructs a new RateLimiter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
Await()
Call this method before any code you want to enforce the rate limit on.
|
protected static final Logger logger
protected final long[] roundBuffer
protected final long milliseconds
protected int index
Copyright © 2016. All rights reserved.