ContextT
- public final class BlockingLimiter<ContextT> extends java.lang.Object implements Limiter<ContextT>
Limiter
that blocks the caller when the limit has been reached. The caller is
blocked until the limiter has been released. This limiter is commonly used in batch
clients that use the limiter as a back-pressure mechanism.Limiter.Listener
Modifier and Type | Method and Description |
---|---|
java.util.Optional<Limiter.Listener> |
acquire(ContextT context)
Acquire a token from the limiter.
|
java.lang.String |
toString() |
static <ContextT> BlockingLimiter<ContextT> |
wrap(Limiter<ContextT> delegate) |
public static <ContextT> BlockingLimiter<ContextT> wrap(Limiter<ContextT> delegate)
public java.util.Optional<Limiter.Listener> acquire(ContextT context)
Limiter
acquire
in interface Limiter<ContextT>
context
- Context for the request. The context is used by advanced startegies such as
LookupPartitionStrategy
.public java.lang.String toString()
toString
in class java.lang.Object