protected class ReentrantLock.WriteLock extends ReentrantLock.Lock
lockCountManager, waitersForLock| Modifier | Constructor and Description |
|---|---|
protected |
WriteLock(LockCountManager<? super T> lockCountManager)
Creates a new write lock using the designated
LockCountManager for comparing objects. |
| Modifier and Type | Method and Description |
|---|---|
void |
lock(T object,
long origTimeout)
Provides the designated object with a write lock.
|
protected boolean |
notificationRequired()
Gets whether a notification of waiting threads is required.
|
currentLockingObject, hasLock, isLocked, lock, objectsWaitingToLock, unlockprotected WriteLock(LockCountManager<? super T> lockCountManager)
LockCountManager for comparing objects.lockCountManager - The manager counting locks for objects.public void lock(T object, long origTimeout) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
Since the lock is reentrant, an object may acquire a lock multiple times. But it also has to release the lock per acquisition afterwards.
lock in class ReentrantLock.Lockobject - The object that requests a write lock.origTimeout - The time to wait for the lock. A timeout <= 0 means to
wait forever (or until the lock is granted).java.lang.InterruptedException - If the thread is interrupted while waiting
for the lock, an InterruptedException will be
thrown.java.util.concurrent.TimeoutException - If the designated timeout elapsed before the
lock can be acquired, a TimeoutException will be
thrown.protected boolean notificationRequired()
notificationRequired in class ReentrantLock.Lock