Package org.apache.hadoop.util
Class InstrumentedReadLock
java.lang.Object
org.apache.hadoop.util.InstrumentedLock
org.apache.hadoop.util.InstrumentedReadLock
- All Implemented Interfaces:
Lock
This is a wrap class of a
ReadLock.
It extends the class InstrumentedLock, and can be used to track
whether a specific read lock is being held for too long and log
warnings if so.
The logged warnings are throttled so that logs are not spammed.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.util.InstrumentedLock
InstrumentedLock.SuppressedSnapshot -
Constructor Summary
ConstructorsConstructorDescriptionInstrumentedReadLock(String name, org.slf4j.Logger logger, ReentrantReadWriteLock readWriteLock, long minLoggingGapMs, long lockWarningThresholdMs) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidStarts timing for the instrumented read lock.voidunlock()Methods inherited from class org.apache.hadoop.util.InstrumentedLock
check, getLock, getTimer, lock, lockInterruptibly, newCondition, tryLock, tryLock
-
Constructor Details
-
InstrumentedReadLock
public InstrumentedReadLock(String name, org.slf4j.Logger logger, ReentrantReadWriteLock readWriteLock, long minLoggingGapMs, long lockWarningThresholdMs)
-
-
Method Details
-
unlock
public void unlock()- Specified by:
unlockin interfaceLock- Overrides:
unlockin classInstrumentedLock
-
startLockTiming
protected void startLockTiming()Starts timing for the instrumented read lock. It records the time to ThreadLocal.- Overrides:
startLockTimingin classInstrumentedLock
-