public interface AsyncDistributedLock extends AsyncPrimitive
DEFAULT_OPERATION_TIMEOUT_MILLIS| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
lock()
Acquires the lock, blocking until it's available.
|
default DistributedLock |
sync()
Returns a synchronous wrapper around the asynchronous primitive.
|
DistributedLock |
sync(Duration operationTimeout)
Returns a synchronous wrapper around the asynchronous primitive.
|
CompletableFuture<Boolean> |
tryLock()
Attempts to acquire the lock.
|
CompletableFuture<Boolean> |
tryLock(Duration timeout)
Attempts to acquire the lock for a specified amount of time.
|
default CompletableFuture<Boolean> |
tryLock(long timeout,
TimeUnit unit)
Attempts to acquire the lock.
|
CompletableFuture<Void> |
unlock()
Unlocks the lock.
|
close, deleteaddStateChangeListener, name, protocol, removeStateChangeListener, typeCompletableFuture<Void> lock()
CompletableFuture<Boolean> tryLock()
default CompletableFuture<Boolean> tryLock(long timeout, TimeUnit unit)
timeout - the timeout after which to give up attempting to acquire the lockunit - the timeout time unitCompletableFuture<Boolean> tryLock(Duration timeout)
timeout - the timeout after which to give up attempting to acquire the lockCompletableFuture<Void> unlock()
default DistributedLock sync()
AsyncPrimitivesync in interface AsyncPrimitiveDistributedLock sync(Duration operationTimeout)
AsyncPrimitivesync in interface AsyncPrimitiveoperationTimeout - the synchronous operation timeoutCopyright © 2013–2018. All rights reserved.