|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.testing.threadtester.ThreadMonitor
public class ThreadMonitor
Utility class that monitors two threads, and waits for one of them to finish. If it determines that the first thread will not finish because of a monitor lock held by the second thread, it will return a status code to indicate that fact.
| Constructor Summary | |
|---|---|
ThreadMonitor(Thread toWait,
Thread other)
Creates a new ThreadMonitor for the given threads. |
|
| Method Summary | |
|---|---|
static long |
getBlockerId(Thread thread)
Returns the thread id of the thread that is blocking the input thread. |
boolean |
waitForThread()
Waits for the first thread to terminate. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ThreadMonitor(Thread toWait,
Thread other)
toWait - the thread to wait for.other - the other thread that may hold locks that will prevent the
first thread from completing.| Method Detail |
|---|
public static long getBlockerId(Thread thread)
public boolean waitForThread()
throws InterruptedException,
TestTimeoutException
TestTimeoutException - if the thread was not blocked by the seond thread,
but still failed to finish.
InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||