org.schmant.run
Class TaskExecutors

java.lang.Object
  extended by org.schmant.run.TaskExecutors

public final class TaskExecutors
extends Object

This class holds an inheritable thread local registry for all created task executors. The Launcher class uses this to make sure that all task executors are properly stopped when its launch method exits.

Scripts don't have to care about this.

Since:
0.5
Author:
Karl Gustafsson

Constructor Summary
TaskExecutors()
           
 
Method Summary
static TaskExecutors init()
          This is called by Launcher to initialize this class.
static void register(TaskExecutor te)
          Register a task executor.
static void shutDownAll(Report r)
           
static void tearDown(TaskExecutors prevTaskExecutors)
          Tear down this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskExecutors

public TaskExecutors()
Method Detail

init

public static TaskExecutors init()
This is called by Launcher to initialize this class.

Returns:
The previous task executors object held by this class, if any. This object is later passed in to the tearDown(TaskExecutors) method by Launcher.
See Also:
tearDown(TaskExecutors)

tearDown

public static void tearDown(TaskExecutors prevTaskExecutors)
Tear down this object.

Parameters:
prevTaskExecutors - The object returned by init().
See Also:
init()

register

public static void register(TaskExecutor te)
                     throws IllegalStateException
Register a task executor. This method should be called by the task executor's constructor.

Parameters:
te - The task executor to register.
Throws:
IllegalStateException - If this object has not yet been initialized by Launcher.

shutDownAll

public static void shutDownAll(Report r)
                        throws IllegalStateException,
                               InterruptedException
Throws:
IllegalStateException
InterruptedException