public interface DistributedLock extends AutoCloseable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
DistributedLock.UnavailableLockListener |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(DistributedLock.UnavailableLockListener listener) |
void |
close() |
String |
getLockId() |
boolean |
isHeldByCaller() |
void |
removeListener(DistributedLock.UnavailableLockListener listener) |
boolean |
tryLock() |
default boolean |
tryLock(long timeout,
TimeUnit unit) |
void |
unlock() |
String getLockId()
boolean isHeldByCaller()
throws UnavailableStateException
UnavailableStateExceptionboolean tryLock()
throws UnavailableStateException,
InterruptedException
default boolean tryLock(long timeout,
TimeUnit unit)
throws UnavailableStateException,
InterruptedException
void unlock()
throws UnavailableStateException
UnavailableStateExceptionvoid addListener(DistributedLock.UnavailableLockListener listener)
void removeListener(DistributedLock.UnavailableLockListener listener)
void close()
close in interface AutoCloseableCopyright © 2021 The Apache Software Foundation. All rights reserved.