|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.conn.tsccm.WaitingThread
@NotThreadSafe public class WaitingThread
Represents a thread waiting for a connection.
This class implements throwaway objects. It is instantiated whenever
a thread needs to wait. Instances are not re-used, except if the
waiting thread experiences a spurious wakeup and continues to wait.
All methods assume external synchronization on the condition
passed to the constructor.
Instances of this class do not synchronize access!
Constructor Summary | |
---|---|
WaitingThread(Condition cond,
RouteSpecificPool pool)
Creates a new entry for a waiting thread. |
Method Summary | |
---|---|
boolean |
await(Date deadline)
Blocks the calling thread. |
Condition |
getCondition()
Obtains the condition. |
RouteSpecificPool |
getPool()
Obtains the pool, if there is one. |
Thread |
getThread()
Obtains the thread, if there is one. |
void |
interrupt()
|
void |
wakeup()
Wakes up the waiting thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WaitingThread(Condition cond, RouteSpecificPool pool)
cond
- the condition for which to waitpool
- the pool on which the thread will be waiting,
or null
Method Detail |
---|
public final Condition getCondition()
null
public final RouteSpecificPool getPool()
null
public final Thread getThread()
null
public boolean await(Date deadline) throws InterruptedException
deadline
- when to time out, or null
for no timeout
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.
InterruptedException
- if the waiting thread was interruptedwakeup()
public void wakeup()
public void interrupt()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |