public class DefaultAsyncLock extends AbstractResource<AsyncLock> implements AsyncLock
context, executor, serializer| Constructor and Description |
|---|
DefaultAsyncLock(ResourceContext context) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> CompletableFuture<T> |
checkOpen(java.util.function.Supplier<CompletableFuture<T>> supplier)
If the lock is closed, returning a failed CompletableFuture.
|
CompletableFuture<Void> |
close() |
CompletableFuture<Boolean> |
lock()
Acquires the lock.
|
CompletableFuture<AsyncLock> |
open() |
CompletableFuture<Void> |
unlock()
Releases the lock.
|
addShutdownTask, addStartupTask, cluster, isClosed, isOpen, name, runShutdownTasks, runStartupTasksclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddShutdownTask, addStartupTask, cluster, namepublic DefaultAsyncLock(ResourceContext context)
protected <T> CompletableFuture<T> checkOpen(java.util.function.Supplier<CompletableFuture<T>> supplier)
T - The future result type.supplier - The supplier to call if the lock is open.public CompletableFuture<Boolean> lock()
AsyncLockpublic CompletableFuture<Void> unlock()
AsyncLockpublic CompletableFuture<AsyncLock> open()
public CompletableFuture<Void> close()
Copyright © 2013-2015. All Rights Reserved.