|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.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> initialTasks)
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.lang.Object |
getParam(java.lang.String name,
java.lang.Object defaultValue)
A convenience method to read parameters from the Map of properties set with the init() method. |
java.util.Collection<FrameworkTask> |
getRunningTasks()
Returns a UnmodifiableCollection that contains the FrameworkTasks in this
TaskSpawner. |
void |
init()
This is a convenience method to initialize this Object. |
void |
init(java.util.Map<java.lang.String,?> params)
This method initializes the module with parameters specified in agent.xml |
protected void |
processResults(FrameworkTask task)
When a finished Task is received and its status is 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 taskManager)
Set the TaskManager this TaskSpawner will use to actually run the tasks. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 taskManager)
TaskSpawner
setTaskManager
in interface TaskSpawner
taskManager
- the TaskManager
of the system.public void addTasks(java.util.Collection<? extends FrameworkTask> initialTasks)
TaskSpawner
addTasks
in interface TaskSpawner
initialTasks
- 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)
task
- the finished Task to processpublic java.util.Collection<FrameworkTask> getRunningTasks()
TaskSpawner
UnmodifiableCollection
that contains the FrameworkTasks in this
TaskSpawner.
getRunningTasks
in interface TaskSpawner
public 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
public void init(java.util.Map<java.lang.String,?> params)
Initializable
init
in interface Initializable
params
- Map of parameters indexed by String namespublic void init()
Initializable
init
in interface Initializable
public java.lang.Object getParam(java.lang.String name, java.lang.Object defaultValue)
Initializable
getParam
in interface Initializable
name
- the parameter namedefaultValue
- the default value to be returned if the parameter doesn't exist.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |