# AbstractQueuedLongSynchronizer.ConditionObject

public class **AbstractQueuedLongSynchronizer.ConditionObject** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Condition](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Condition.html) [Serializable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html) Condition implementation for a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html` serving as the basis of a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Lock.html` implementation.

Method documentation for this class describes mechanics,
not behavioral specifications from the point of view of Lock
and Condition users. Exported versions of this class will in
general need to be accompanied by documentation describing
condition semantics that rely on those of the associated
`AbstractQueuedLongSynchronizer`.

This class is Serializable, but all fields are transient,
so deserialized conditions have no waiters.

### Public Constructor Summary

|---|---|
|   | [ConditionObject](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#ConditionObject())() Creates a new `ConditionObject` instance. |

### Public Method Summary

|---|---|
| final void | [await](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#await())() Implements interruptible condition wait. |
| final boolean | [await](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#await(long,%20java.util.concurrent.TimeUnit))(long time, [TimeUnit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/TimeUnit.html) unit) Implements timed condition wait. |
| final long | [awaitNanos](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#awaitNanos(long))(long nanosTimeout) Implements timed condition wait. |
| final void | [awaitUninterruptibly](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#awaitUninterruptibly())() Implements uninterruptible condition wait. |
| final boolean | [awaitUntil](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#awaitUntil(java.util.Date))([Date](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Date.html) deadline) Implements absolute timed condition wait. |
| final void | [signal](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#signal())() Moves the longest-waiting thread, if one exists, from the wait queue for this condition to the wait queue for the owning lock. |
| final void | [signalAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#signalAll())() Moves all threads from the wait queue for this condition to the wait queue for the owning lock. |

### Protected Method Summary

|---|---|
| final int | [getWaitQueueLength](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#getWaitQueueLength())() Returns an estimate of the number of threads waiting on this condition. |
| final [Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<Thread\> | [getWaitingThreads](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#getWaitingThreads())() Returns a collection containing those threads that may be waiting on this Condition. |
| final boolean | [hasWaiters](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.ConditionObject.html#hasWaiters())() Queries whether any threads are waiting on this condition. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.util.concurrent.locks.Condition](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Condition.html)

|---|---|
| abstract void | [await](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Condition.html#await())() Causes the current thread to wait until it is signalled or {@linkplain Thread#interrupt interrupted}. |
| abstract boolean | [await](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Condition.html#await(long,%20java.util.concurrent.TimeUnit))(long time, [TimeUnit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/TimeUnit.html) unit) Causes the current thread to wait until it is signalled or interrupted, or the specified waiting time elapses. |
| abstract long | [awaitNanos](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Condition.html#awaitNanos(long))(long nanosTimeout) Causes the current thread to wait until it is signalled or interrupted, or the specified waiting time elapses. |
| abstract void | [awaitUninterruptibly](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Condition.html#awaitUninterruptibly())() Causes the current thread to wait until it is signalled. |
| abstract boolean | [awaitUntil](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Condition.html#awaitUntil(java.util.Date))([Date](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Date.html) deadline) Causes the current thread to wait until it is signalled or interrupted, or the specified deadline elapses. |
| abstract void | [signal](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Condition.html#signal())() Wakes up one waiting thread. |
| abstract void | [signalAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/Condition.html#signalAll())() Wakes up all waiting threads. |

## Public Constructors

#### public
**ConditionObject**
()

Creates a new `ConditionObject` instance.

## Public Methods

#### public final void
**await**
()

Implements interruptible condition wait.

1. If current thread is interrupted, throw InterruptedException.
2. Save lock state returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#getState()`.
3. Invoke `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#release(long)` with saved state as argument, throwing IllegalMonitorStateException if it fails.
4. Block until signalled or interrupted.
5. Reacquire by invoking specialized version of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#acquire(long)` with saved state as argument.
6. If interrupted while blocked in step 4, throw InterruptedException.

<br />

##### Throws

| [InterruptedException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/InterruptedException.html) |   |
|---|---|

#### public final boolean
**await**
(long time, [TimeUnit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/TimeUnit.html) unit)

Implements timed condition wait.

1. If current thread is interrupted, throw InterruptedException.
2. Save lock state returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#getState()`.
3. Invoke `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#release(long)` with saved state as argument, throwing IllegalMonitorStateException if it fails.
4. Block until signalled, interrupted, or timed out.
5. Reacquire by invoking specialized version of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#acquire(long)` with saved state as argument.
6. If interrupted while blocked in step 4, throw InterruptedException.
7. If timed out while blocked in step 4, return false, else true.

<br />

##### Parameters

| time | the maximum time to wait |
| unit | the time unit of the `time` argument |
|---|---|

##### Returns

- `false` if the waiting time detectably elapsed before return from the method, else `true`

##### Throws

| [InterruptedException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/InterruptedException.html) |   |
|---|---|

#### public final long
**awaitNanos**
(long nanosTimeout)

Implements timed condition wait.

1. If current thread is interrupted, throw InterruptedException.
2. Save lock state returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#getState()`.
3. Invoke `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#release(long)` with saved state as argument, throwing IllegalMonitorStateException if it fails.
4. Block until signalled, interrupted, or timed out.
5. Reacquire by invoking specialized version of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#acquire(long)` with saved state as argument.
6. If interrupted while blocked in step 4, throw InterruptedException.

<br />

##### Parameters

| nanosTimeout | the maximum time to wait, in nanoseconds |
|---|---|

##### Returns

- 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/InterruptedException.html) |   |
|---|---|

#### public final void
**awaitUninterruptibly**
()

Implements uninterruptible condition wait.

1. Save lock state returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#getState()`.
2. Invoke `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#release(long)` with saved state as argument, throwing IllegalMonitorStateException if it fails.
3. Block until signalled.
4. Reacquire by invoking specialized version of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#acquire(long)` with saved state as argument.

<br />

#### public final boolean
**awaitUntil**
([Date](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Date.html) deadline)

Implements absolute timed condition wait.

1. If current thread is interrupted, throw InterruptedException.
2. Save lock state returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#getState()`.
3. Invoke `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#release(long)` with saved state as argument, throwing IllegalMonitorStateException if it fails.
4. Block until signalled, interrupted, or timed out.
5. Reacquire by invoking specialized version of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#acquire(long)` with saved state as argument.
6. If interrupted while blocked in step 4, throw InterruptedException.
7. If timed out while blocked in step 4, return false, else true.

<br />

##### Parameters

| deadline | the absolute time to wait until |
|---|---|

##### Returns

- `false` if the deadline has elapsed upon return, else `true`

##### Throws

| [InterruptedException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/InterruptedException.html) |   |
|---|---|

#### public final void
**signal**
()

Moves the longest-waiting thread, if one exists, from the
wait queue for this condition to the wait queue for the
owning lock.

##### Throws

| [IllegalMonitorStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalMonitorStateException.html) | if `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#isHeldExclusively()` returns `false` |
|---|---|

#### public final void
**signalAll**
()

Moves all threads from the wait queue for this condition to
the wait queue for the owning lock.

##### Throws

| [IllegalMonitorStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalMonitorStateException.html) | if `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#isHeldExclusively()` returns `false` |
|---|---|

## Protected Methods

#### protected final int
**getWaitQueueLength**
()

Returns an estimate of the number of threads waiting on
this condition.
Implements `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#getWaitQueueLength(java.util.concurrent.locks.AbstractQueuedLongSynchronizer.ConditionObject)`.

##### Returns

- the estimated number of waiting threads

##### Throws

| [IllegalMonitorStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalMonitorStateException.html) | if `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#isHeldExclusively()` returns `false` |
|---|---|

#### protected final [Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<Thread\>
**getWaitingThreads**
()

Returns a collection containing those threads that may be
waiting on this Condition.
Implements `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#getWaitingThreads(java.util.concurrent.locks.AbstractQueuedLongSynchronizer.ConditionObject)`.

##### Returns

- the collection of threads

##### Throws

| [IllegalMonitorStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalMonitorStateException.html) | if `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#isHeldExclusively()` returns `false` |
|---|---|

#### protected final boolean
**hasWaiters**
()

Queries whether any threads are waiting on this condition.
Implements `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#hasWaiters(java.util.concurrent.locks.AbstractQueuedLongSynchronizer.ConditionObject)`.

##### Returns

- `true` if there are any waiting threads

##### Throws

| [IllegalMonitorStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalMonitorStateException.html) | if `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html#isHeldExclusively()` returns `false` |
|---|---|