| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Lock | readLock()
Implements java. Returns the lock used for reading. |
| public Lock | writeLock()
Implements java. Returns the lock used for writing. |
| ReadWriteLockDummy | back to summary |
|---|---|
| public ReadWriteLockDummy() | |
| readLock | back to summary |
|---|---|
| public Lock readLock() Implements java. Doc from java. Returns the lock used for reading. | |
| writeLock | back to summary |
|---|---|
| public Lock writeLock() Implements java. Doc from java. Returns the lock used for writing. | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | lockInterruptibly()
Implements java. Acquires the lock unless the current thread is interrupted. |
| public Condition | newCondition()
Implements java. Returns a new |
| public boolean | tryLock()
Implements java. Acquires the lock only if it is free at the time of invocation. |
| public boolean | tryLock(long time, TimeUnit unit)
Implements java. Acquires the lock if it is free within the given waiting time and the current thread has not been interrupted. |
| public void |
| LockDummy | back to summary |
|---|---|
| public LockDummy() | |
| lock | back to summary |
|---|---|
| public void lock() Implements java. Doc from java. Acquires the lock. If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired. Implementation Considerations A | |
| lockInterruptibly | back to summary |
|---|---|
| public void lockInterruptibly() Implements java. Doc from java. Acquires the lock unless the current thread is interrupted. Acquires the lock if it is available and returns immediately. If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:
If the current thread:
InterruptedException is thrown and the current thread's
interrupted status is cleared.
Implementation Considerations The ability to interrupt a lock acquisition in some implementations may not be possible, and if possible may be an expensive operation. The programmer should be aware that this may be the case. An implementation should document when this is the case. An implementation can favor responding to an interrupt over normal method return. A | |
| newCondition | back to summary |
|---|---|
| public Condition newCondition() Implements java. Doc from java. Returns a new Before waiting on the condition the lock must be held by the
current thread.
A call to Implementation Considerations The exact operation of the | |
| tryLock | back to summary |
|---|---|
| public boolean tryLock() Implements java. Doc from java. Acquires the lock only if it is free at the time of invocation. Acquires the lock if it is available and returns immediately
with the value A typical usage idiom for this method would be:
This usage ensures that the lock is unlocked if it was acquired, and
doesn't try to unlock if the lock was not acquired.
| |
| tryLock | back to summary |
|---|---|
| public boolean tryLock(long time, TimeUnit unit) Implements java. Doc from java. Acquires the lock if it is free within the given waiting time and the current thread has not been interrupted. If the lock is available this method returns immediately
with the value
If the lock is acquired then the value If the current thread:
InterruptedException is thrown and the current thread's
interrupted status is cleared.
If the specified waiting time elapses then the value Implementation Considerations The ability to interrupt a lock acquisition in some implementations may not be possible, and if possible may be an expensive operation. The programmer should be aware that this may be the case. An implementation should document when this is the case. An implementation can favor responding to an interrupt over normal method return, or reporting a timeout. A | |
| unlock | back to summary |
|---|---|
| public void unlock() Implements java. Doc from java. Releases the lock. Implementation Considerations A | |