public interface AsyncSemaphoreLock extends AbstractAsyncLock<AsyncSemaphoreLock.Token>
| Modifier and Type | Interface and Description |
|---|---|
static interface |
AsyncSemaphoreLock.Token
A semaphore token indicating that necessary permit has been exclusively acquired.
|
| Modifier and Type | Method and Description |
|---|---|
default Promise<AsyncSemaphoreLock.Token> |
acquire()
Exclusively acquires this lock.
|
Promise<AsyncSemaphoreLock.Token> |
acquire(long permits) |
long |
availablePermits() |
static AsyncSemaphoreLock |
create(long permits,
boolean fair) |
Optional<AsyncSemaphoreLock.Token> |
drainPermits() |
int |
getQueueLength() |
default Optional<AsyncSemaphoreLock.Token> |
tryAcquire()
Attempts to immediately acquire the lock, returning a populated
Optional if the lock is
not currently held. |
Optional<AsyncSemaphoreLock.Token> |
tryAcquire(long permits) |
long availablePermits()
int getQueueLength()
Optional<AsyncSemaphoreLock.Token> drainPermits()
default Optional<AsyncSemaphoreLock.Token> tryAcquire()
AbstractAsyncLockOptional if the lock is
not currently held.tryAcquire in interface AbstractAsyncLock<AsyncSemaphoreLock.Token>Optional holding a AbstractAsyncLock.Token if the lock is not held; otherwise an
empty OptionalOptional<AsyncSemaphoreLock.Token> tryAcquire(long permits)
default Promise<AsyncSemaphoreLock.Token> acquire()
AbstractAsyncLock
The AbstractAsyncLock.Token held by the returned stage is used to release the
lock after it has been acquired and the lock-protected action has
completed.
acquire in interface AbstractAsyncLock<AsyncSemaphoreLock.Token>Promise which will complete with a
AbstractAsyncLock.Token when the lock has been exclusively acquiredPromise<AsyncSemaphoreLock.Token> acquire(long permits)
static AsyncSemaphoreLock create(long permits, boolean fair)
Copyright © 2021. All rights reserved.