|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.memphis.ccrg.lida.framework.initialization.InitializableImpl edu.memphis.ccrg.lida.framework.tasks.TaskSpawnerImpl
public class TaskSpawnerImpl
Maintains a queue of running tasks and their task status. Methods to add and
cancel tasks. This implementation actually uses TaskManager
to
execute the tasks.
Constructor Summary | |
---|---|
TaskSpawnerImpl()
This default constructor is used by the AgentXmlFactory . |
|
TaskSpawnerImpl(TaskManager tm)
Convenience constructor that sets the TaskManager |
Method Summary | |
---|---|
void |
addTask(FrameworkTask task)
Adds and runs supplied FrameworkTask. |
void |
addTasks(java.util.Collection<? extends FrameworkTask> tasks)
Adds and runs supplied FrameworkTasks. |
boolean |
cancelTask(FrameworkTask task)
Cancels specified task if it exists in this TaskSpawner
Task is removed from TaskSpawner and canceled in the TaskManager . |
boolean |
containsTask(FrameworkTask task)
Returns whether this TaskSpawner manages this task. |
java.util.Collection<FrameworkTask> |
getRunningTasks()
Deprecated. |
java.util.Collection<FrameworkTask> |
getTasks()
Returns the FrameworkTask objects controlled by this TaskSpawner. |
protected void |
processResults(FrameworkTask task)
When a FrameworkTask has completed one execution and its status is TaskStatus.FINISHED_WITH_RESULTS
this method is called to handle the results. |
void |
receiveFinishedTask(FrameworkTask task)
This method receives a task that has finished. |
void |
setTaskManager(TaskManager tm)
Set the TaskManager this TaskSpawner will use to actually run the tasks. |
Methods inherited from class edu.memphis.ccrg.lida.framework.initialization.InitializableImpl |
---|
containsParameter, getParam, getParameters, init, init |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.Initializable |
---|
containsParameter, getParam, getParameters, init, init |
Constructor Detail |
---|
public TaskSpawnerImpl()
AgentXmlFactory
.
TaskManager
must be set using TaskSpawner.setTaskManager(TaskManager)
public TaskSpawnerImpl(TaskManager tm)
TaskManager
tm
- the TaskManager
to setMethod Detail |
---|
public void setTaskManager(TaskManager tm)
TaskSpawner
setTaskManager
in interface TaskSpawner
tm
- the TaskManager
of the system.public void addTasks(java.util.Collection<? extends FrameworkTask> tasks)
TaskSpawner
addTasks
in interface TaskSpawner
tasks
- a collection of tasks to be run.public void addTask(FrameworkTask task)
TaskSpawner
addTask
in interface TaskSpawner
task
- the task to add.public void receiveFinishedTask(FrameworkTask task)
TaskSpawner
TaskStatus
determines this action.
receiveFinishedTask
in interface TaskSpawner
task
- finished FrameworkTask
protected void processResults(FrameworkTask task)
FrameworkTask
has completed one execution and its status is TaskStatus.FINISHED_WITH_RESULTS
this method is called to handle the results.
task
- the task to be processedpublic boolean cancelTask(FrameworkTask task)
TaskSpawner
TaskSpawner
Task is removed from TaskSpawner
and canceled in the TaskManager
.
This is only possible if the tick for which the task
is scheduled has not been reached.
cancelTask
in interface TaskSpawner
task
- The task to cancel.
TaskManager.cancelTask(FrameworkTask)
public boolean containsTask(FrameworkTask task)
TaskSpawner
containsTask
in interface TaskSpawner
task
- a FrameworkTask
TaskSpawner
contains a task with task's id@Deprecated public java.util.Collection<FrameworkTask> getRunningTasks()
TaskSpawner
UnmodifiableCollection
that contains the FrameworkTasks in this
TaskSpawner. Tasks' TaskStatus may or may not be running.
Use TaskSpawner.getTasks()
instead.
getRunningTasks
in interface TaskSpawner
public java.util.Collection<FrameworkTask> getTasks()
TaskSpawner
FrameworkTask
objects controlled by this TaskSpawner.
getTasks
in interface TaskSpawner
Collection
FrameworkTasks.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |