public class AbstractQueuedLongSynchronizer.ConditionObject
extends Object
implements Condition, Serializable
java.lang.Object | |
↳ | java.util.concurrent.locks.AbstractQueuedLongSynchronizer.ConditionObject |
AbstractQueuedLongSynchronizer
条件实现作为 Lock
实现的基础。
此类的方法文档描述了机制,而不是从锁定和条件用户的角度来看行为规范。 该类的导出版本通常需要伴随着描述依赖关联的AbstractQueuedLongSynchronizer
条件语义的文档。
这个类是可序列化的,但所有字段都是暂时的,所以反序列化的条件没有服务员。
Public constructors |
|
---|---|
AbstractQueuedLongSynchronizer.ConditionObject() 创建一个新的 |
Public methods |
|
---|---|
final void |
await() 实施中断条件等。 |
final boolean |
await(long time, TimeUnit unit) 实现定时条件等待。 |
final long |
awaitNanos(long nanosTimeout) 实现定时条件等待。 |
final void |
awaitUninterruptibly() 实现不间断条件等待。 |
final boolean |
awaitUntil(Date deadline) 实现绝对定时条件等待。 |
final void |
signal() 将等候时间最长的线程(如果存在)从此状态的等待队列移至拥有锁的等待队列。 |
final void |
signalAll() 将此条件的等待队列中的所有线程移至拥有锁的等待队列。 |
Protected methods |
|
---|---|
final int |
getWaitQueueLength() 返回等待此条件的线程数的估计值。 |
final Collection<Thread> |
getWaitingThreads() 返回包含可能在此Condition上等待的线程的集合。 |
final boolean |
hasWaiters() 查询是否有线程正在等待这种情况。 |
Inherited methods |
|
---|---|
From class java.lang.Object
|
|
From interface java.util.concurrent.locks.Condition
|
AbstractQueuedLongSynchronizer.ConditionObject ()
创建一个新的 ConditionObject
实例。
void await ()
实施中断条件等。
getState()
. release(long)
with saved state as argument, throwing IllegalMonitorStateException if it fails. acquire(long)
with saved state as argument. Throws | |
---|---|
InterruptedException |
boolean await (long time, TimeUnit unit)
实现定时条件等待。
getState()
. release(long)
with saved state as argument, throwing IllegalMonitorStateException if it fails. acquire(long)
with saved state as argument. Parameters | |
---|---|
time |
long : the maximum time to wait |
unit |
TimeUnit : the time unit of the time argument |
Returns | |
---|---|
boolean |
false if the waiting time detectably elapsed before return from the method, else true |
Throws | |
---|---|
InterruptedException |
long awaitNanos (long nanosTimeout)
实现定时条件等待。
getState()
. release(long)
with saved state as argument, throwing IllegalMonitorStateException if it fails. acquire(long)
with saved state as argument. Parameters | |
---|---|
nanosTimeout |
long : the maximum time to wait, in nanoseconds |
Returns | |
---|---|
long |
an estimate of the nanosTimeout value minus the time spent waiting upon return from this method. A positive value may be used as the argument to a subsequent call to this method to finish waiting out the desired time. A value less than or equal to zero indicates that no time remains. |
Throws | |
---|---|
InterruptedException |
void awaitUninterruptibly ()
Implements uninterruptible condition wait.
getState()
. release(long)
with saved state as argument, throwing IllegalMonitorStateException if it fails. acquire(long)
with saved state as argument. boolean awaitUntil (Date deadline)
实现绝对定时条件等待。
getState()
. release(long)
with saved state as argument, throwing IllegalMonitorStateException if it fails. acquire(long)
with saved state as argument. Parameters | |
---|---|
deadline |
Date : the absolute time to wait until |
Returns | |
---|---|
boolean |
false if the deadline has elapsed upon return, else true |
Throws | |
---|---|
InterruptedException |
void signal ()
将等候时间最长的线程(如果存在)从此状态的等待队列移至拥有锁的等待队列。
Throws | |
---|---|
IllegalMonitorStateException |
if isHeldExclusively() returns false |
void signalAll ()
将此条件的等待队列中的所有线程移至拥有锁的等待队列。
Throws | |
---|---|
IllegalMonitorStateException |
if isHeldExclusively() returns false |
int getWaitQueueLength ()
返回等待此条件的线程数的估计值。 实现getWaitQueueLength(ConditionObject)
。
Returns | |
---|---|
int |
the estimated number of waiting threads |
Throws | |
---|---|
IllegalMonitorStateException |
if isHeldExclusively() returns false |
Collection<Thread> getWaitingThreads ()
返回包含可能在此Condition上等待的线程的集合。 实现getWaitingThreads(ConditionObject)
。
Returns | |
---|---|
Collection<Thread> |
the collection of threads |
Throws | |
---|---|
IllegalMonitorStateException |
if isHeldExclusively() returns false |
boolean hasWaiters ()
查询是否有线程正在等待这种情况。 实现hasWaiters(ConditionObject)
。
Returns | |
---|---|
boolean |
true if there are any waiting threads |
Throws | |
---|---|
IllegalMonitorStateException |
if isHeldExclusively() returns false |