public class DefaultAsyncLock extends Object implements AsyncLock
AsyncLock.Token| Constructor and Description |
|---|
DefaultAsyncLock() |
| Modifier and Type | Method and Description |
|---|---|
Promise<AsyncLock.Token> |
acquire()
Exclusively acquires this lock.
|
String |
toString() |
Optional<AsyncLock.Token> |
tryAcquire()
Attempts to immediately acquire the lock, returning a populated
Optional if the lock is
not currently held. |
public Optional<AsyncLock.Token> tryAcquire()
AbstractAsyncLockOptional if the lock is
not currently held.tryAcquire in interface AbstractAsyncLock<AsyncLock.Token>Optional holding a AbstractAsyncLock.Token if the lock is not held; otherwise an
empty Optionalpublic Promise<AsyncLock.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<AsyncLock.Token>Promise which will complete with a
AbstractAsyncLock.Token when the lock has been exclusively acquiredCopyright © 2021. All rights reserved.