@ThreadSafe @ParametersAreNonnullByDefault public interface PermitSupplier
Modifier and Type | Method and Description |
---|---|
default void |
acquire(int nrPermits,
long timeout,
TimeUnit unit)
Acquire a arbitrary number of permits.
|
default void |
acquire(long timeout,
TimeUnit unit)
Acquire one permit.
|
default Semaphore |
toSemaphore() |
boolean |
tryAcquire(int nrPermits,
long deadlineNanos) |
default boolean |
tryAcquire(int nrPermits,
long timeout,
TimeUnit unit)
try to acquire a number of permits.
|
default boolean |
tryAcquire(long timeout,
TimeUnit unit)
try to acquire a permit.
|
default void acquire(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException
timeout
- time to wait for permit to become available.unit
- units of time.InterruptedException
- - operation interrupted.TimeoutException
- - timed out.default void acquire(int nrPermits, @Nonnegative long timeout, TimeUnit unit) throws InterruptedException, TimeoutException
nrPermits
- - numer of permits to acquire.timeout
- - time to wait for permit to become available.unit
- - units of time.InterruptedException
- - operation interrupted.TimeoutException
- - timed out.@CheckReturnValue default boolean tryAcquire(@Nonnegative long timeout, TimeUnit unit) throws InterruptedException
timeout
- time to wait for permit to become available.unit
- units of time.InterruptedException
- - operation interrupted.@CheckReturnValue default boolean tryAcquire(@Nonnegative int nrPermits, @Nonnegative long timeout, TimeUnit unit) throws InterruptedException
nrPermits
- number of permits to acquire.timeout
- time to wait for permits to become available.unit
- units of time.InterruptedException
- - operation interrupted.@CheckReturnValue boolean tryAcquire(@Nonnegative int nrPermits, long deadlineNanos) throws InterruptedException
InterruptedException
default Semaphore toSemaphore()
Copyright © 2018 SPF4J. All rights reserved.