com.massimo.tools.scriptrunner.control
Class TaskRunner

java.lang.Object
  extended by com.massimo.tools.scriptrunner.control.TaskRunner
All Implemented Interfaces:
Runnable

public class TaskRunner
extends Object
implements Runnable

Simple class to help manage multi-threaded tasks.
Remembers the Thread it which it was started, so that both the Task and the Thread can be interrupted.


Constructor Summary
TaskRunner(Task task, ExecutionContext context)
           
 
Method Summary
 String getName()
           
 int getResult()
           
 void interrupt()
          Attempt to interrupt the task and also its working thread.
 boolean isRunning()
           
 void run()
           Save the working thread; and run the Task.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TaskRunner

public TaskRunner(Task task,
                  ExecutionContext context)
Parameters:
task -
context -
Method Detail

getName

public String getName()
Returns:
The Task's name

getResult

public int getResult()
Returns:
int The Task's result if it has finished.

interrupt

public void interrupt()
Attempt to interrupt the task and also its working thread.


isRunning

public boolean isRunning()
Returns:
boolean True if the Task is still processing

run

public void run()
Save the working thread; and run the Task.

Specified by:
run in interface Runnable

toString

public String toString()

Overrides:
toString in class Object