@InterfaceAudience.Private public abstract class IdReadWriteLock<T> extends Object
ReentrantReadWriteLock lock = idReadWriteLock.getLock(id);
try {
lock.readLock().lock();
// User code.
} finally {
lock.readLock().unlock();
}
For write lock, use lock.writeLock()| Constructor and Description |
|---|
IdReadWriteLock() |
| Modifier and Type | Method and Description |
|---|---|
abstract ReentrantReadWriteLock |
getLock(T id) |
void |
waitForWaiters(T id,
int numWaiters) |
public abstract ReentrantReadWriteLock getLock(T id)
public void waitForWaiters(T id, int numWaiters) throws InterruptedException
InterruptedExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.