Condition.
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | await()
Implements java. |
| public boolean | await(long
the maximum time to wait time, TimeUnit the time unit of the unit)time argumentImplements java. |
| public long | awaitNanos(long
the maximum time to wait, in nanoseconds nanosTimeout)Implements java. |
| public void | awaitUninterruptibly()
Implements java. |
| public boolean | awaitUntil(Date
the absolute time to wait until deadline)Implements java. |
| pack-priv abstract Condition | |
| public void | |
| public void |
| ForwardingCondition | back to summary |
|---|---|
| pack-priv ForwardingCondition() | |
| await | back to summary |
|---|---|
| public void await() throws InterruptedException Implements java. Doc from java. Causes the current thread to wait until it is signalled or interrupted. The lock associated with this
In all cases, before this method can return the current thread must re-acquire the lock associated with this condition. When the thread returns it is guaranteed to hold this lock. If the current thread:
InterruptedException is thrown and the current thread's
interrupted status is cleared. It is not specified, in the first
case, whether or not the test for interruption occurs before the lock
is released.
Implementation Considerations The current thread is assumed to hold the lock associated with this
An implementation can favor responding to an interrupt over normal method return in response to a signal. In that case the implementation must ensure that the signal is redirected to another waiting thread, if there is one.
| |
| await | back to summary |
|---|---|
| public boolean await(long time, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Causes the current thread to wait until it is signalled or interrupted, or the specified waiting time elapses. This method is behaviorally equivalent to:
| |
| awaitNanos | back to summary |
|---|---|
| public long awaitNanos(long nanosTimeout) throws InterruptedException Implements java. Doc from java. Causes the current thread to wait until it is signalled or interrupted, or the specified waiting time elapses. The lock associated with this condition is atomically released and the current thread becomes disabled for thread scheduling purposes and lies dormant until one of five things happens:
In all cases, before this method can return the current thread must re-acquire the lock associated with this condition. When the thread returns it is guaranteed to hold this lock. If the current thread:
InterruptedException is thrown and the current thread's
interrupted status is cleared. It is not specified, in the first
case, whether or not the test for interruption occurs before the lock
is released.
The method returns an estimate of the number of nanoseconds
remaining to wait given the supplied Design Note This method requires a nanosecond argument so as to avoid truncation errors in reporting remaining times. Such precision loss would make it difficult for programmers to ensure that total waiting times are not systematically shorter than specified when re-waits occur. Implementation Considerations The current thread is assumed to hold the lock associated with this
An implementation can favor responding to an interrupt over normal method return in response to a signal, or over indicating the elapse of the specified waiting time. In either case the implementation must ensure that the signal is redirected to another waiting thread, if there is one.
| |
| awaitUninterruptibly | back to summary |
|---|---|
| public void awaitUninterruptibly() Implements java. Doc from java. Causes the current thread to wait until it is signalled. The lock associated with this condition is atomically released and the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
In all cases, before this method can return the current thread must re-acquire the lock associated with this condition. When the thread returns it is guaranteed to hold this lock. If the current thread's interrupted status is set when it enters this method, or it is interrupted while waiting, it will continue to wait until signalled. When it finally returns from this method its interrupted status will still be set. Implementation Considerations The current thread is assumed to hold the lock associated with this
| |
| awaitUntil | back to summary |
|---|---|
| public boolean awaitUntil(Date deadline) throws InterruptedException Implements java. Doc from java. Causes the current thread to wait until it is signalled or interrupted, or the specified deadline elapses. The lock associated with this condition is atomically released and the current thread becomes disabled for thread scheduling purposes and lies dormant until one of five things happens:
In all cases, before this method can return the current thread must re-acquire the lock associated with this condition. When the thread returns it is guaranteed to hold this lock. If the current thread:
InterruptedException is thrown and the current thread's
interrupted status is cleared. It is not specified, in the first
case, whether or not the test for interruption occurs before the lock
is released.
The return value indicates whether the deadline has elapsed, which can be used as follows:
Implementation Considerations The current thread is assumed to hold the lock associated with this
An implementation can favor responding to an interrupt over normal method return in response to a signal, or over indicating the passing of the specified deadline. In either case the implementation must ensure that the signal is redirected to another waiting thread, if there is one.
| |
| delegate | back to summary |
|---|---|
| pack-priv abstract Condition delegate() | |
| signal | back to summary |
|---|---|
| public void signal() Implements java. Doc from java. Wakes up one waiting thread. If any threads are waiting on this condition then one
is selected for waking up. That thread must then re-acquire the
lock before returning from Implementation Considerations An implementation may (and typically does) require that the
current thread hold the lock associated with this
| |
| signalAll | back to summary |
|---|---|
| public void signalAll() Implements java. Doc from java. Wakes up all waiting threads. If any threads are waiting on this condition then they are
all woken up. Each thread must re-acquire the lock before it can
return from Implementation Considerations An implementation may (and typically does) require that the
current thread hold the lock associated with this
| |