|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ourgrid.test.threadServices.ThreadLists
public class ThreadLists
This class handles the list of running and waiting threads of an application. It is used by the RunningThreadsMonitor aspect but is very general. The wait functionalities are suggested for service threads.
Constructor Summary | |
---|---|
ThreadLists()
Default constructor. |
Method Summary | |
---|---|
void |
addWaiting(java.lang.Object o)
Adds the current thread on the list of threads waiting for a certain object. |
void |
includeInRunningThreads(java.lang.Thread t)
Include in running threads a given thread. |
void |
includeInStartedThreads(java.lang.Thread t)
Include in running threads a given thread. |
boolean |
isThreadRunning(java.lang.Thread t)
Verifies if a given thread is running (it has started its run method and has not leaved it. |
boolean |
isThreadStarted(java.lang.Thread t)
Verifies if a given thread is started, but not running yet |
boolean |
isThreadWaiting(java.lang.Thread t)
Verifies if a given thread is waiting |
void |
notifyAllWaitingThreads(java.lang.Object o)
Notifies all theads waiting for an object o |
void |
notifyOneWaitingThread(java.lang.Object o)
Notifies a thread that is waiting for an object o |
void |
println(java.lang.String str)
General method that prints the string parameter on the standard output. |
void |
printRunningThreads()
Prints the running threads. |
void |
printStartedThreads()
Prints the started threads. |
void |
printWaitingThreads()
Prints the waiting threads. |
protected void |
removeFromWaitingThreads(java.lang.Thread t)
Removes a certain thread from the list of waiting threads. |
void |
removeRunnableThread()
Removes a runnable thread from the list. |
void |
waitUntilAllThreadsDie()
Waits until all running threads die. |
void |
waitUntilThreadHasFinished(java.lang.Thread t)
Puts the current thread to wait until a certain Thread t leaves the run method. |
void |
waitUntilThreadHasStartedRunning(java.lang.Thread t)
Waits until a given thread enters the run state. |
void |
waitUntilThreadIsWaiting(java.lang.Thread t)
Waits until a given thread is waiting. |
void |
waitUntilWorkIsDoneNotifying()
This method puts the current running thread to wait until all application running threads are waiting. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThreadLists()
Method Detail |
---|
public void waitUntilAllThreadsDie()
public void waitUntilWorkIsDoneNotifying()
public void waitUntilThreadHasFinished(java.lang.Thread t)
t
- The thread we must wait until it stops running.public void waitUntilThreadHasStartedRunning(java.lang.Thread t)
t
- The thread you want to wait for.public void waitUntilThreadIsWaiting(java.lang.Thread t)
t
- The thread you want to wait for.public boolean isThreadRunning(java.lang.Thread t)
t
- The wanted thread
public boolean isThreadStarted(java.lang.Thread t)
t
- The wanted thread
public boolean isThreadWaiting(java.lang.Thread t)
t
- The wanted thread
public void includeInRunningThreads(java.lang.Thread t)
t
- The thread to be included.public void includeInStartedThreads(java.lang.Thread t)
t
- The thread to be included.protected void removeFromWaitingThreads(java.lang.Thread t)
t
- The thread to be removed.public void addWaiting(java.lang.Object o)
o
- The waited object.public void notifyAllWaitingThreads(java.lang.Object o)
o
- The object where a notifyAll was called.public void notifyOneWaitingThread(java.lang.Object o)
o
- The object where a notify was called.public void printWaitingThreads()
public void printStartedThreads()
public void printRunningThreads()
public void removeRunnableThread()
public void println(java.lang.String str)
str
- String to be printed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |