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, createFair
public 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 AsyncLock
CompletionStage
which will complete with a AsyncLock.LockToken
when the lock
has been exclusively acquiredpublic Optional<AsyncLock.LockToken> tryLock()
AsyncLock
Optional
if the lock is
not currently held.tryLock
in interface AsyncLock
Optional
holding a AsyncLock.LockToken
if the lock is not held; otherwise an
empty OptionalCopyright © 2018. All rights reserved.