Class MultiBinaryLongMap.ChainedLock

  • All Implemented Interfaces:
    Lock
    Enclosing class:
    MultiBinaryLongMap

    protected static class MultiBinaryLongMap.ChainedLock
    extends Object
    implements Lock
    A ChainedLock is a Lock implementation that represents a composition of two component locks, parent and child. All operations on this lock will first be performed on the parent lock, and only upon successful completion be performed on the child lock.

    A ChainedLock could be used to manage multiple logical levels of concurrency control across multiple components without exposing multiple resource locks and thus imposing a locking order that reduces the possibility of introducing deadlocks.

    Note: a ChainedLock could be used to represent a chain of more than two Locks by constructing a "chain of chains".

    • Field Detail

      • f_lockParent

        protected final Lock f_lockParent
        The "parent" constituent lock.
      • f_lockChild

        protected final Lock f_lockChild
        The "child" constituent lock.
    • Constructor Detail

      • ChainedLock

        public ChainedLock​(Lock lockParent,
                           Lock lockChild)
        Construct a new ChainedLock composed of the specified parent and child locks.
        Parameters:
        lockParent - the parent lock
        lockChild - the child lock