Package com.tangosol.util
Class MultiBinaryLongMap.PrimaryBinaryLongMap.ValidatingLock
java.lang.Object
com.tangosol.util.MultiBinaryLongMap.PrimaryBinaryLongMap.ValidatingLock
- All Implemented Interfaces:
Lock
- Enclosing class:
MultiBinaryLongMap.PrimaryBinaryLongMap
protected class MultiBinaryLongMap.PrimaryBinaryLongMap.ValidatingLock
extends Object
implements Lock
ValidatingLock is a Lock implementation specialized for the
PrimaryBinaryLongMap that validates after every lock acquisition that
the underlying BinaryLongMap implementation did not change.
Note: ValidatingLock is assumed to be used by the PrimaryBinaryLongMap to wrap lock implementations that are dependent (chained) to the "master" RW-lock. As the master RW-lock is used to protect any structural changes, it also implicitly serves as a JMM memory barrier that guarantees a "flush" of the map implementation reference.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LockThe underlying lock.protected BinaryLongMapThe primary BinaryLongMap implementation to check for -
Constructor Summary
ConstructorsConstructorDescriptionValidatingLock(BinaryLongMap blm, Lock lock) Construct a ValidatingLock backed by the specified Lock.ValidatingLock(Lock lock) Construct a ValidatingLock backed by the specified Lock. -
Method Summary
Modifier and TypeMethodDescriptionprotected BinaryLongMapReturn the primary BinaryLongMap implementation validate by this ValidatingLock.voidlock()voidprotected voidsetImplMap(BinaryLongMap blmImpl) Set the primary BinaryLongMap implementation to be validated by this ValidatingLock.booleantryLock()booleanvoidunlock()protected voidvalidate()Validate that the BinaryLongMap associated with this ValidatingLock is still the implementation map of the containing PrimaryBinaryLongMap.
-
Field Details
-
f_lock
The underlying lock. -
m_blmImpl
The primary BinaryLongMap implementation to check for
-
-
Constructor Details
-
ValidatingLock
Construct a ValidatingLock backed by the specified Lock.- Parameters:
lock- the underlying lock
-
ValidatingLock
Construct a ValidatingLock backed by the specified Lock.- Parameters:
blm- the primary BinaryLongMap implementation to validatelock- the underlying lock
-
-
Method Details
-
unlock
public void unlock() -
lock
public void lock() -
lockInterruptibly
- Specified by:
lockInterruptiblyin interfaceLock- Throws:
InterruptedException
-
tryLock
public boolean tryLock() -
tryLock
- Specified by:
tryLockin interfaceLock- Throws:
InterruptedException
-
newCondition
- Specified by:
newConditionin interfaceLock
-
getImplMap
Return the primary BinaryLongMap implementation validate by this ValidatingLock.- Returns:
- the primary BinaryLongMap implementation validated by this ValidatingLock
-
setImplMap
Set the primary BinaryLongMap implementation to be validated by this ValidatingLock.- Parameters:
blmImpl- the primary BinaryLongMap implementation
-
validate
protected void validate()Validate that the BinaryLongMap associated with this ValidatingLock is still the implementation map of the containing PrimaryBinaryLongMap.Callers are required to hold the lock. Note: the lock provides a memory barrier ensuring visibility of updates to the map implementation of the outer PrimaryBinaryLongMap.
-