Package org.apache.ignite.internal.util
Class ReentrantReadWriteLockWithTracking
- java.lang.Object
-
- org.apache.ignite.internal.util.ReentrantReadWriteLockWithTracking
-
- All Implemented Interfaces:
ReadWriteLock
public class ReentrantReadWriteLockWithTracking extends Object implements ReadWriteLock
ReentrantReadWriteLock adapter with readLock tracking.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReentrantReadWriteLockWithTracking.ReadLockWithTrackingTracks long rlock holders.
-
Field Summary
Fields Modifier and Type Field Description static StringLOCK_HOLD_MESSAGELock hold message.
-
Constructor Summary
Constructors Constructor Description ReentrantReadWriteLockWithTracking()Delegator implementation.ReentrantReadWriteLockWithTracking(IgniteLogger log, long readLockThreshold)ReentrantRWLock wrapper, provides additional trace info onReentrantReadWriteLockWithTracking.ReadLockWithTracking.unlock()method, if someone holds the lock more thanreadLockThreshold.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetReadHoldCount()Queries the number of reentrant read holds on this lock by the current thread.intgetReadLockCount()Queries the number of read locks held for this lock.booleanisWriteLockedByCurrentThread()Queries if the write lock is held by the current thread.longlockWaitThreshold()ReentrantReadWriteLock.ReadLockreadLock()ReentrantReadWriteLock.WriteLockwriteLock()
-
-
-
Field Detail
-
LOCK_HOLD_MESSAGE
public static final String LOCK_HOLD_MESSAGE
Lock hold message.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReentrantReadWriteLockWithTracking
public ReentrantReadWriteLockWithTracking(IgniteLogger log, long readLockThreshold)
ReentrantRWLock wrapper, provides additional trace info onReentrantReadWriteLockWithTracking.ReadLockWithTracking.unlock()method, if someone holds the lock more thanreadLockThreshold.- Parameters:
log- Ignite logger.readLockThreshold- ReadLock threshold timeout.
-
ReentrantReadWriteLockWithTracking
public ReentrantReadWriteLockWithTracking()
Delegator implementation.
-
-
Method Detail
-
readLock
public ReentrantReadWriteLock.ReadLock readLock()
- Specified by:
readLockin interfaceReadWriteLock
-
writeLock
public ReentrantReadWriteLock.WriteLock writeLock()
- Specified by:
writeLockin interfaceReadWriteLock
-
lockWaitThreshold
public long lockWaitThreshold()
-
isWriteLockedByCurrentThread
public boolean isWriteLockedByCurrentThread()
Queries if the write lock is held by the current thread.- Returns:
trueif the current thread holds the write lock andfalseotherwise
-
getReadHoldCount
public int getReadHoldCount()
Queries the number of reentrant read holds on this lock by the current thread. A reader thread has a hold on a lock for each lock action that is not matched by an unlock action.- Returns:
- the number of holds on the read lock by the current thread, or zero if the read lock is not held by the current thread
-
getReadLockCount
public int getReadLockCount()
Queries the number of read locks held for this lock. This method is designed for use in monitoring system state, not for synchronization control.- Returns:
- the number of read locks held
-
-