Package com.ibm.fhir.task.core.impl
Class TaskManager
- java.lang.Object
-
- com.ibm.fhir.task.core.impl.TaskManager
-
- All Implemented Interfaces:
ITaskCollector
public class TaskManager extends Object implements ITaskCollector
Manages the execution of a set of dependent task groups using theExecutorServiceprovided.
-
-
Constructor Summary
Constructors Constructor Description TaskManager(ExecutorService pool)Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<ITaskGroup>getFailedTaskGroups()Return a list of all theITaskGroupobjects which ran but failed This list does not contain any task groups which were not started (because they have dependencies on task groups which failed).ITaskGroupmakeTaskGroup(String taskId, Runnable r, List<ITaskGroup> children)Add the given task to the task groupvoidstartAndWait()Process the tasks, starting with the childless leaf tasks, waiting for everything to completevoidsubmit(TaskGroup tg)Submit the task group to the poolvoidtaskComplete(TaskGroup tg)Callback from each task group made when it completesvoidtaskFailed(TaskGroup tg)Receipt of a signal from the task group that it has failed.
-
-
-
Constructor Detail
-
TaskManager
public TaskManager(ExecutorService pool)
Public constructor- Parameters:
pool-
-
-
Method Detail
-
submit
public void submit(TaskGroup tg)
Submit the task group to the pool- Parameters:
tg-
-
getFailedTaskGroups
public Collection<ITaskGroup> getFailedTaskGroups()
Description copied from interface:ITaskCollectorReturn a list of all theITaskGroupobjects which ran but failed This list does not contain any task groups which were not started (because they have dependencies on task groups which failed).- Specified by:
getFailedTaskGroupsin interfaceITaskCollector- Returns:
-
makeTaskGroup
public ITaskGroup makeTaskGroup(String taskId, Runnable r, List<ITaskGroup> children)
Description copied from interface:ITaskCollectorAdd the given task to the task group- Specified by:
makeTaskGroupin interfaceITaskCollector- Parameters:
taskId- the parent to tell when we're done. Can be nullr- the runnable to call to process the task- Returns:
-
startAndWait
public void startAndWait()
Description copied from interface:ITaskCollectorProcess the tasks, starting with the childless leaf tasks, waiting for everything to complete- Specified by:
startAndWaitin interfaceITaskCollector
-
taskComplete
public void taskComplete(TaskGroup tg)
Callback from each task group made when it completes
-
taskFailed
public void taskFailed(TaskGroup tg)
Receipt of a signal from the task group that it has failed. No taskComplete will be called, so we need to signal it's the end of the road- Parameters:
tg-
-
-