|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dellroad.stuff.java.ThreadParkingLot
public class ThreadParkingLot
A place for threads to be parked and unparked.
| Constructor Summary | |
|---|---|
ThreadParkingLot()
|
|
| Method Summary | |
|---|---|
boolean |
isParked(Thread thread)
Determine if the given thread is currently parked on this instance. |
boolean |
park(long timeout)
Park the current thread on this instance. |
boolean |
unpark(Thread thread)
Unpark a thread. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ThreadParkingLot()
| Method Detail |
|---|
public boolean park(long timeout)
throws InterruptedException
unpark() is invoked
by some other thread with the current thread as the parameter, the given non-zero timeout expires, or
the current thread is interrupted.
timeout - maximum time to stay parked, or zero to park indefinitely
true if the thread was unparked by another thread, false if the timeout expired
IllegalArgumentException - if timeout is negative
InterruptedException - if the current thread is interruptedpublic boolean unpark(Thread thread)
thread - the thread to unpark
true if thread was successfully unparked, false if thread
is not parked on this instancepublic boolean isParked(Thread thread)
thread - the thread in question
true if thread is currently parked on this instance, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||