ContextT
- Context type used to partition the limit. Void if none.public interface Strategy<ContextT>
Modifier and Type | Interface and Description |
---|---|
static interface |
Strategy.Token
Representation of a single acquired Token from the strategy.
|
Modifier and Type | Method and Description |
---|---|
void |
setLimit(int limit)
Update the strategy with a new limit
|
java.util.Optional<Strategy.Token> |
tryAcquire(ContextT context)
Try to acquire a token from the limiter.
|
java.util.Optional<Strategy.Token> tryAcquire(ContextT context)
context
- Context of the request for partitioned limitsStrategy.Token
that must be released when
the operation completes.void setLimit(int limit)
limit
-