public class MinTokenBucket extends TokenBucket
TokenBucket
that caps the token balance to some given minimum value.
This is useful for quotas where we want to record values into a sensor but temporarily ignore any rate limiting.
The MinTokenBucket
will discount tokens recorded under a given min value, bounding the max throttle
experienced once rate limiting is enforced.
In comparison, the TokenBucket
will continuously consume tokens, that would need to be replenished,
resulting in unbounded throttle time.Constructor and Description |
---|
MinTokenBucket(double minTokens) |
Modifier and Type | Method and Description |
---|---|
protected void |
updateTokens(double tokens) |
measure, record, toString
protected void updateTokens(double tokens)
updateTokens
in class TokenBucket