Package org.pipservices3.components.lock
Class NullLock
java.lang.Object
org.pipservices3.components.lock.NullLock
- All Implemented Interfaces:
ILock
Dummy lock implementation that doesn't do anything.
It can be used in testing or in situations when lock is required but shall be disabled.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacquireLock(String correlationId, String key, int ttl, long timeout) Makes multiple attempts to acquire a lock by its key within give time interval.voidreleaseLock(String correlationId, String key) Releases prevously acquired lock by its key.booleantryAcquireLock(String correlationId, String key, int ttl) Makes a single attempt to acquire a lock by its key.
-
Constructor Details
-
NullLock
public NullLock()
-
-
Method Details
-
tryAcquireLock
Makes a single attempt to acquire a lock by its key. It returns immediately a positive or negative result.- Specified by:
tryAcquireLockin interfaceILock- Parameters:
correlationId- (optional) transaction id to trace execution through call chain.key- a unique lock key to acquire.ttl- a lock timeout (time to live) in milliseconds.- Returns:
trueif the lock was acquired andfalseotherwise.
-
acquireLock
Makes multiple attempts to acquire a lock by its key within give time interval.- Specified by:
acquireLockin interfaceILock- Parameters:
correlationId- (optional) transaction id to trace execution through call chain.key- a unique lock key to acquire.ttl- a lock timeout (time to live) in milliseconds.timeout- a lock acquisition timeout.
-
releaseLock
Releases prevously acquired lock by its key.- Specified by:
releaseLockin interfaceILock- Parameters:
correlationId- (optional) transaction id to trace execution through call chain.key- a unique lock key to release.
-