Package io.siddhi.core.util.lock
Class LockWrapper
- java.lang.Object
-
- io.siddhi.core.util.lock.LockWrapper
-
public class LockWrapper extends Object
A wrapper class forReentrantLockwhich is used to share and sync locks across various components of Siddhi. LockWrapper creates a mutable instance where the internal lock can be assigned and reassigned to new instances. However, internal lock is not intended to be replaced after initialization.
-
-
Constructor Summary
Constructors Constructor Description LockWrapper(String lockId)Construct an empty LockWrapper object with no lock inside.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)ReentrantLockgetLock()Return the internal lock of theLockWrapperinthashCode()voidlock()Acquires the lock.voidsetLock(ReentrantLock lock)Set the internal lock to thisLockWrappervoidunlock()Release the lock.
-
-
-
Constructor Detail
-
LockWrapper
public LockWrapper(String lockId)
Construct an empty LockWrapper object with no lock inside.- Parameters:
lockId- id of the lock. Cannot be null.
-
-
Method Detail
-
getLock
public ReentrantLock getLock()
Return the internal lock of theLockWrapper- Returns:
- the actual lock which is used by this instance
-
setLock
public void setLock(ReentrantLock lock)
Set the internal lock to thisLockWrapper- Parameters:
lock- the actual lock to be used
-
lock
public void lock()
Acquires the lock.
-
unlock
public void unlock()
Release the lock.
-
-