public abstract class NonRefillableLimiter extends Object implements Limiter
Limiters that do not support permit refills by returning a no-op
Closeable in acquirePermits(long).| Modifier and Type | Field and Description |
|---|---|
protected static Closeable |
NO_OP_CLOSEABLE |
| Constructor and Description |
|---|
NonRefillableLimiter() |
| Modifier and Type | Method and Description |
|---|---|
Closeable |
acquirePermits(long permits)
Acquire a given number of permits.
|
protected static final Closeable NO_OP_CLOSEABLE
public Closeable acquirePermits(long permits) throws InterruptedException
LimiterDepending on the implementation, the caller of this method may be blocked. It is also up to the caller to decide how to deal with the return value.
acquirePermits in interface Limiterpermits - number of permits to getCloseable instance if the requested permits have been successfully acquired,
or null if otherwise; in the former case, calling Closeable.close() on
the returned Closeable instance will release the acquired permits.InterruptedException - if the caller is interrupted while being blocked