org.ourgrid.test.threadServices
Class ShutdownableRunnable

java.lang.Object
  extended by org.ourgrid.test.threadServices.ShutdownableRunnable
All Implemented Interfaces:
java.lang.Runnable, Shutdownable

public class ShutdownableRunnable
extends java.lang.Object
implements Shutdownable, java.lang.Runnable

This class is used to perform tests on the threadServices package using several threads.


Field Summary
static boolean DEBUG
          A debug variable.
protected  boolean mustShutdown
          Signals when the scheduler must shutdown
 
Constructor Summary
ShutdownableRunnable()
          Constructor of this runnable, creating its Thread object.
ShutdownableRunnable(boolean withInner)
          Constructor with a boolean indicating if in this Runnable we should create other Threads.
 
Method Summary
 ShutdownableThread getMyThread()
          Gets the thread related with this Runnable.
 boolean isThereAnythingToDo()
          Gets the flag value that indicates if there is something to do.
 void println(java.lang.String str)
          General method that prints the string parameter on the standard output.
 void run()
          Prints some messages and creates InnerRunnable objects depending on the situation.
 void setIsThereAnythingToDo(boolean isThere)
          Sets the flag that indicates if there is something to do.
 void shutdown()
          Marks the scheduler thread to be shutdown.
 void startShutdownable()
          Starts the thread related with this Runnable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
A debug variable.

See Also:
Constant Field Values

mustShutdown

protected boolean mustShutdown
Signals when the scheduler must shutdown

Constructor Detail

ShutdownableRunnable

public ShutdownableRunnable()
Constructor of this runnable, creating its Thread object.


ShutdownableRunnable

public ShutdownableRunnable(boolean withInner)
Constructor with a boolean indicating if in this Runnable we should create other Threads.

Parameters:
withInner - Indicates if in this Runnable run method other threads should be created.
Method Detail

startShutdownable

public void startShutdownable()
Starts the thread related with this Runnable.


shutdown

public void shutdown()
Marks the scheduler thread to be shutdown.

Specified by:
shutdown in interface Shutdownable

run

public void run()
Prints some messages and creates InnerRunnable objects depending on the situation.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

isThereAnythingToDo

public boolean isThereAnythingToDo()
Gets the flag value that indicates if there is something to do.

Returns:
Returns true if there is anything to do and false, otherwise.

setIsThereAnythingToDo

public void setIsThereAnythingToDo(boolean isThere)
Sets the flag that indicates if there is something to do.

Parameters:
isThere - The nothingToDo to set.

getMyThread

public ShutdownableThread getMyThread()
Gets the thread related with this Runnable.

Returns:
Returns the myThread.

println

public void println(java.lang.String str)
General method that prints the string parameter on the standard output.

Parameters:
str - String to be printed.