public static interface TokenBucket.RefillStrategy
| Modifier and Type | Method and Description |
|---|---|
long |
getDurationUntilNextRefill(TimeUnit unit)
Returns the amount of time in the specified time unit until the next group of tokens can be added to the token
bucket.
|
long |
refill()
Returns the number of tokens to add to the token bucket.
|
long refill()
long getDurationUntilNextRefill(TimeUnit unit) throws UnsupportedOperationException
SleepStrategy used by the token bucket, tokens may not actually
be added until much after the returned duration. If for some reason the implementation of
RefillStrategy doesn't support knowing when the next batch of tokens will be added, then an
UnsupportedOperationException may be thrown. Lastly, if the duration until the next time tokens will
be added to the token bucket is less than a single unit of the passed in time unit then this method will
return 0.unit - The time unit to express the return value in.UnsupportedOperationExceptionCopyright © 2015. All Rights Reserved.