AsyncLock.LockToken| Constructor | Description |
|---|---|
FairAsyncLock() |
| Modifier and Type | Method | Description |
|---|---|---|
CompletionStage<AsyncLock.LockToken> |
acquireLock() |
Exclusively acquires this lock.
|
Optional<AsyncLock.LockToken> |
tryLock() |
Attempts to immediately acquire the lock, returning a populated
Optional if the lock is
not currently held. |
create, createFairpublic CompletionStage<AsyncLock.LockToken> acquireLock()
AsyncLock
The AsyncLock.LockToken held by the returned stage is used to release the lock after it has been
acquired and the lock-protected action has completed.
acquireLock in interface AsyncLockCompletionStage which will complete with a AsyncLock.LockToken when the lock
has been exclusively acquiredpublic Optional<AsyncLock.LockToken> tryLock()
AsyncLockOptional if the lock is
not currently held.tryLock in interface AsyncLockOptional holding a AsyncLock.LockToken if the lock is not held; otherwise an
empty OptionalCopyright © 2018. All rights reserved.