Package org.apache.hadoop.hbase.util
Class IdReadWriteLock<T>
java.lang.Object
org.apache.hadoop.hbase.util.IdReadWriteLock<T>
- Direct Known Subclasses:
IdReadWriteLockStrongRef,IdReadWriteLockWithObjectPool
Allows multiple concurrent clients to lock on a numeric id with ReentrantReadWriteLock. The
intended usage for read lock is as follows:
ReentrantReadWriteLock lock = idReadWriteLock.getLock(id);
try {
lock.readLock().lock();
// User code.
} finally {
lock.readLock().unlock();
}
For write lock, use lock.writeLock()-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ReentrantReadWriteLockvoidwaitForWaiters(T id, int numWaiters)
-
Constructor Details
-
IdReadWriteLock
public IdReadWriteLock()
-
-
Method Details
-
getLock
-
waitForWaiters
- Throws:
InterruptedException
-