Interface DistributedLock
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface DistributedLock extends java.lang.AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceDistributedLock.UnavailableLockListener
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddListener(DistributedLock.UnavailableLockListener listener)voidclose()java.lang.StringgetLockId()booleanisHeldByCaller()voidremoveListener(DistributedLock.UnavailableLockListener listener)booleantryLock()default booleantryLock(long timeout, java.util.concurrent.TimeUnit unit)voidunlock()
-
-
-
Method Detail
-
getLockId
java.lang.String getLockId()
-
isHeldByCaller
boolean isHeldByCaller() throws UnavailableStateException- Throws:
UnavailableStateException
-
tryLock
boolean tryLock() throws UnavailableStateException, java.lang.InterruptedException- Throws:
UnavailableStateExceptionjava.lang.InterruptedException
-
tryLock
default boolean tryLock(long timeout, java.util.concurrent.TimeUnit unit) throws UnavailableStateException, java.lang.InterruptedException- Throws:
UnavailableStateExceptionjava.lang.InterruptedException
-
unlock
void unlock() throws UnavailableStateException- Throws:
UnavailableStateException
-
addListener
void addListener(DistributedLock.UnavailableLockListener listener)
-
removeListener
void removeListener(DistributedLock.UnavailableLockListener listener)
-
close
void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-