Class LockWrapper


  • public class LockWrapper
    extends Object
    A wrapper class for ReentrantLock which 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 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 the LockWrapper
        Returns:
        the actual lock which is used by this instance
      • setLock

        public void setLock​(ReentrantLock lock)
        Set the internal lock to this LockWrapper
        Parameters:
        lock - the actual lock to be used
      • lock

        public void lock()
        Acquires the lock.
      • unlock

        public void unlock()
        Release the lock.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object