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, or a timeout is reached. 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) |
static <ContextT> BlockingLimiter<ContextT> |
wrap(Limiter<ContextT> delegate,
java.time.Duration timeout) |
public static <ContextT> BlockingLimiter<ContextT> wrap(Limiter<ContextT> delegate)
public static <ContextT> BlockingLimiter<ContextT> wrap(Limiter<ContextT> delegate, java.time.Duration timeout)
public java.util.Optional<Limiter.Listener> acquire(ContextT context)
Limiter
public java.lang.String toString()
toString
in class java.lang.Object