Class NonReentrantCuratorReadWriteLock


  • public class NonReentrantCuratorReadWriteLock
    extends java.lang.Object
    A non-reentrate read-write lock. This implementation is essentially stolen from Curator's InterProcessReadWriteLock, but eliminates the re-entrancy. In particular, this allows a person to release the lock with a different thread than the one that acquires it.
    • Constructor Detail

      • NonReentrantCuratorReadWriteLock

        public NonReentrantCuratorReadWriteLock​(org.apache.curator.framework.CuratorFramework client,
                                                java.lang.String basePath)
        Parameters:
        client - the client
        basePath - path to use for locking
      • NonReentrantCuratorReadWriteLock

        public NonReentrantCuratorReadWriteLock​(org.apache.curator.framework.CuratorFramework client,
                                                java.lang.String basePath,
                                                byte[] lockData)
        Parameters:
        client - the client
        basePath - path to use for locking
        lockData - the data to store in the lock nodes
    • Method Detail

      • readLock

        public InterProcessTxLock readLock()
        Returns the lock used for reading.
        Returns:
        read lock
      • writeLock

        public InterProcessTxLock writeLock()
        Returns the lock used for writing.
        Returns:
        write lock