Package com.tangosol.util
Class MultiBinaryLongMap.ChainedLock
- java.lang.Object
-
- com.tangosol.util.MultiBinaryLongMap.ChainedLock
-
- All Implemented Interfaces:
Lock
- Enclosing class:
- MultiBinaryLongMap
protected static class MultiBinaryLongMap.ChainedLock extends Object implements Lock
A ChainedLock is aLock
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 Summary
Fields Modifier and Type Field Description protected Lock
f_lockChild
The "child" constituent lock.protected Lock
f_lockParent
The "parent" constituent lock.
-
Constructor Summary
Constructors Constructor Description ChainedLock(Lock lockParent, Lock lockChild)
Construct a new ChainedLock composed of the specified parent and child locks.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
lock()
void
lockInterruptibly()
Condition
newCondition()
boolean
tryLock()
boolean
tryLock(long cTime, TimeUnit unit)
void
unlock()
-
-
-
Method Detail
-
lockInterruptibly
public void lockInterruptibly() throws InterruptedException
- Specified by:
lockInterruptibly
in interfaceLock
- Throws:
InterruptedException
-
tryLock
public boolean tryLock(long cTime, TimeUnit unit) throws InterruptedException
- Specified by:
tryLock
in interfaceLock
- Throws:
InterruptedException
-
newCondition
public Condition newCondition()
- Specified by:
newCondition
in interfaceLock
-
-