Interface DistributedLock
-
- All Superinterfaces:
AutoCloseable
public interface DistributedLock extends 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()StringgetLockId()booleanisHeldByCaller()voidremoveListener(DistributedLock.UnavailableLockListener listener)booleantryLock()default booleantryLock(long timeout, TimeUnit unit)voidunlock()
-
-
-
Method Detail
-
getLockId
String getLockId()
-
isHeldByCaller
boolean isHeldByCaller() throws UnavailableStateException- Throws:
UnavailableStateException
-
tryLock
boolean tryLock() throws UnavailableStateException, InterruptedException
-
tryLock
default boolean tryLock(long timeout, TimeUnit unit) throws UnavailableStateException, 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 interfaceAutoCloseable
-
-