Top Description Fields Constructors Methods
org.apache.http.impl.conn.tsccm

public Class WaitingThread

extends Object
Class Inheritance
Annotations
@Deprecated
Imports
java.util.Date, java.util.concurrent.locks.Condition, org.apache.http.util.Args

Deprecated

(4.2) do not use

Represents a thread waiting for a connection.

This class implements throw away objects. It is instantiated whenever a thread needs to wait. Instances are not re-used, except if the waiting thread experiences a spurious wake up and continues to wait.

All methods assume external synchronization on the condition passed to the constructor. Instances of this class do not synchronize access!

Since
4.0

Field Summary

Modifier and TypeField and Description
private boolean
aborted

True if this was interrupted.

private final Condition
cond

The condition on which the thread is waiting.

private final RouteSpecificPool
pool

The route specific pool on which the thread is waiting.

private Thread
waiter

The thread that is waiting for an entry.

Constructor Summary

AccessConstructor and Description
public
WaitingThread(final Condition
the condition for which to wait
cond
,
final RouteSpecificPool
the pool on which the thread will be waiting, or null
pool
)

Deprecated as a consequence of RouteSpecificPool being deprecated.
Creates a new entry for a waiting thread.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the condition was satisfied, false in case of a timeout. Typically, a call to wakeup is used to indicate that the condition was satisfied. Since the condition is accessible outside, this cannot be guaranteed though.
await
(final Date
when to time out, or null for no timeout
deadline
)

Blocks the calling thread.

public final Condition

Returns:

the condition on which to wait, never null
getCondition
()

Obtains the condition.

public final RouteSpecificPool

Returns:

the pool on which a thread is or was waiting, or null
getPool
()

Deprecated as a consequence of RouteSpecificPool being deprecated.
Obtains the pool, if there is one.
public final Thread

Returns:

the thread which is waiting, or null
getThread
()

Obtains the thread, if there is one.

public void
public void
wakeup()

Wakes up the waiting thread.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

abortedback to summary
private boolean aborted

True if this was interrupted.

condback to summary
private final Condition cond

The condition on which the thread is waiting.

poolback to summary
private final RouteSpecificPool pool

Deprecated

as a consequence of RouteSpecificPool being deprecated. See corresponding docs for further information.

The route specific pool on which the thread is waiting.

waiterback to summary
private Thread waiter

The thread that is waiting for an entry.

Constructor Detail

WaitingThreadback to summary
public WaitingThread(final Condition cond, final RouteSpecificPool pool)

Deprecated

as a consequence of RouteSpecificPool being deprecated. See corresponding docs for further information.

Creates a new entry for a waiting thread.

Parameters
cond:Condition

the condition for which to wait

pool:RouteSpecificPool

the pool on which the thread will be waiting, or null

Method Detail

awaitback to summary
public boolean await(final Date deadline) throws InterruptedException

Blocks the calling thread. This method returns when the thread is notified or interrupted, if a timeout occurrs, or if there is a spurious wakeup.

This method assumes external synchronization.

Parameters
deadline:Date

when to time out, or null for no timeout

Returns:boolean

true if the condition was satisfied, false in case of a timeout. Typically, a call to wakeup is used to indicate that the condition was satisfied. Since the condition is accessible outside, this cannot be guaranteed though.

Exceptions
InterruptedException:
if the waiting thread was interrupted
See Also
wakeup
getConditionback to summary
public final Condition getCondition()

Obtains the condition.

Returns:Condition

the condition on which to wait, never null

getPoolback to summary
public final RouteSpecificPool getPool()

Deprecated

as a consequence of RouteSpecificPool being deprecated. See corresponding docs for further information.

Obtains the pool, if there is one.

Returns:RouteSpecificPool

the pool on which a thread is or was waiting, or null

getThreadback to summary
public final Thread getThread()

Obtains the thread, if there is one.

Returns:Thread

the thread which is waiting, or null

interruptback to summary
public void interrupt()
wakeupback to summary
public void wakeup()

Wakes up the waiting thread.

This method assumes external synchronization.