Located in compilation unit of org.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | |
| public int | |
| public boolean | |
| public boolean | |
| 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
the maximum time to wait for the lock timeout, TimeUnit the time unit of the unit)time argumentImplements java. Acquires the lock if it is free within the given waiting time and the current thread has not been interrupted. |
| public void |
| sync | back to summary |
|---|---|
| private final Mutex. | |
| Mutex | back to summary |
|---|---|
| pack-priv Mutex() | |
| getOwnerName | back to summary |
|---|---|
| pack-priv String getOwnerName() | |
| getWaitQueueLength | back to summary |
|---|---|
| public int getWaitQueueLength(Condition condition) | |
| hasQueuedThreads | back to summary |
|---|---|
| public boolean hasQueuedThreads() | |
| isLocked | back to summary |
|---|---|
| public boolean isLocked() | |
| 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() throws InterruptedException 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 timeout, TimeUnit unit) throws InterruptedException 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 | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv Thread | |
| protected boolean | isHeldExclusively()
Overrides java. Returns |
| pack-priv AbstractQueuedSynchronizer. | |
| public boolean | tryAcquire(int
the acquire argument. This value is always the one
passed to an acquire method, or is the value saved on entry
to a condition wait. The value is otherwise uninterpreted
and can represent anything you like. acquires)Overrides java. Attempts to acquire in exclusive mode. |
| protected boolean | tryRelease(int
the release argument. This value is always the one
passed to a release method, or the current state value upon
entry to a condition wait. The value is otherwise
uninterpreted and can represent anything you like. releases)Overrides java. Attempts to set the state to reflect a release in exclusive mode. |
| Sync | back to summary |
|---|---|
| private Sync() | |
| getOwner | back to summary |
|---|---|
| pack-priv Thread getOwner() | |
| isHeldExclusively | back to summary |
|---|---|
| protected boolean isHeldExclusively() Overrides java. Doc from java. Returns The default implementation throws
| |
| newCondition | back to summary |
|---|---|
| pack-priv AbstractQueuedSynchronizer. | |
| tryAcquire | back to summary |
|---|---|
| public boolean tryAcquire(int acquires) Overrides java. Doc from java. Attempts to acquire in exclusive mode. This method should query if the state of the object permits it to be acquired in the exclusive mode, and if so to acquire it. This method is always invoked by the thread performing
acquire. If this method reports failure, the acquire method
may queue the thread, if it is not already queued, until it is
signalled by a release from some other thread. This can be used
to implement method The default
implementation throws
| |
| tryRelease | back to summary |
|---|---|
| protected boolean tryRelease(int releases) Overrides java. Doc from java. Attempts to set the state to reflect a release in exclusive mode. This method is always invoked by the thread performing release. The default implementation throws
| |