Package org.cyclos.impl.locks
Interface LockHandler
-
public interface LockHandlerContains methods to access pessimistic locks on entities
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidlock(String key)Locks with a typeLockType.CUSTOMand the given keydefault voidlock(String key, long timeInMillis)Locks with a typeLockType.CUSTOMand the given key waiting for a custom time in millisvoidlock(LockKey key)Locks the given id on the given lock type.voidlock(LockKey key, long timeInMillis)Waits the given time to acquire the locks the given id on the given lock typedefault booleantryLock(String key)Try a lock with a typeLockType.CUSTOMand the given key, returning whether the lock was acquiredbooleantryLock(LockKey key)Locks the given id on the given lock type only if it is free at the time of invocation.
-
-
-
Method Detail
-
lock
void lock(LockKey key) throws LockAcquisitionException
Locks the given id on the given lock type.- Throws:
LockAcquisitionException
-
lock
void lock(LockKey key, long timeInMillis) throws LockAcquisitionException
Waits the given time to acquire the locks the given id on the given lock type- Throws:
LockAcquisitionException
-
lock
default void lock(String key) throws LockAcquisitionException
Locks with a typeLockType.CUSTOMand the given key- Throws:
LockAcquisitionException
-
lock
default void lock(String key, long timeInMillis) throws LockAcquisitionException
Locks with a typeLockType.CUSTOMand the given key waiting for a custom time in millis- Throws:
LockAcquisitionException
-
tryLock
boolean tryLock(LockKey key)
Locks the given id on the given lock type only if it is free at the time of invocation.
-
tryLock
default boolean tryLock(String key)
Try a lock with a typeLockType.CUSTOMand the given key, returning whether the lock was acquired
-
-