org.ourgrid.test.threadServices
Class ThreadServices

java.lang.Object
  extended by org.ourgrid.test.threadServices.ThreadServices
Direct Known Subclasses:
ExtendedThreadServices

public class ThreadServices
extends java.lang.Object

Class that presents fake methods, that will be replaced by correct ones using an aspect (RunningThreadsMonitor) when it is included. If the code is not compiled using the aspects, the methods to wait will simply call sleep. Otherwise, this class methods will be replaced by the ones from threadServices.ThreadLists.


Constructor Summary
ThreadServices()
           
 
Method Summary
static boolean areAllThreadsWaiting()
           
static void printRunningThreads()
          Prints the running threads.
static void printStartedThreads()
          Prints the started threads.
static void printWaitingThreads()
          Prints the waiting threads.
static void throwNotUsingAspectsException()
          Throws a RuntimeException indicating that the classes that use this package should be compiled using AspectJ compiler.
static void waitThreadsDie()
          Fake method.
static void waitUntilThreadHasFinished(java.lang.Thread t)
           
static void waitUntilThreadHasStartedRunning(java.lang.Thread t)
           
static void waitUntilThreadIsWaiting(java.lang.Thread t)
           
static void waitUntilWorkIsDone()
          This method simply waits the current threads finish their jobs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadServices

public ThreadServices()
Method Detail

waitUntilWorkIsDone

public static void waitUntilWorkIsDone()
This method simply waits the current threads finish their jobs. It can be redefinied in order to verify if the current application threads have finished to run, or are under their run method execution but waiting.


waitUntilThreadHasFinished

public static void waitUntilThreadHasFinished(java.lang.Thread t)
See Also:
if using aspects.

waitUntilThreadHasStartedRunning

public static void waitUntilThreadHasStartedRunning(java.lang.Thread t)
See Also:
if using aspects.

throwNotUsingAspectsException

public static void throwNotUsingAspectsException()
Throws a RuntimeException indicating that the classes that use this package should be compiled using AspectJ compiler.


areAllThreadsWaiting

public static boolean areAllThreadsWaiting()
Returns:
Without aspects, this method simply returns true. If using aspects, see ThreadLists.areAllThreadsWaiting();
See Also:
ThreadLists.areAllRunningThreadsWaiting()

waitThreadsDie

public static void waitThreadsDie()
Fake method. Without aspects it waits with a sleep.

See Also:
ThreadLists.waitUntilAllThreadsDie()

waitUntilThreadIsWaiting

public static void waitUntilThreadIsWaiting(java.lang.Thread t)
See Also:
ThreadLists.waitUntilThreadIsWaiting(Thread)

printWaitingThreads

public static void printWaitingThreads()
Prints the waiting threads.

See Also:
ThreadLists.printWaitingThreads()

printStartedThreads

public static void printStartedThreads()
Prints the started threads.

See Also:
ThreadLists.printStartedThreads()

printRunningThreads

public static void printRunningThreads()
Prints the running threads.

See Also:
ThreadLists.printRunningThreads()