com.massimo.tools.scriptrunner.control
Class TaskRunner
java.lang.Object
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.
TaskRunner
public TaskRunner(Task task,
ExecutionContext context)
- Parameters:
task
- context
-
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