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 java.lang.Object implements ITaskCollector
Manages the execution of a set of dependent task groups using theExecutorService
provided.
-
-
Constructor Summary
Constructors Constructor Description TaskManager(java.util.concurrent.ExecutorService pool)
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<ITaskGroup>
getFailedTaskGroups()
Return a list of all theITaskGroup
objects 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).ITaskGroup
makeTaskGroup(java.lang.String taskId, java.lang.Runnable r, java.util.List<ITaskGroup> children)
Add the given task to the task groupvoid
startAndWait()
Process the tasks, starting with the childless leaf tasks, waiting for everything to completevoid
submit(TaskGroup tg)
Submit the task group to the poolvoid
taskComplete(TaskGroup tg)
Callback from each task group made when it completesvoid
taskFailed(TaskGroup tg)
Receipt of a signal from the task group that it has failed.
-
-
-
Method Detail
-
submit
public void submit(TaskGroup tg)
Submit the task group to the pool- Parameters:
tg
-
-
getFailedTaskGroups
public java.util.Collection<ITaskGroup> getFailedTaskGroups()
Description copied from interface:ITaskCollector
Return a list of all theITaskGroup
objects 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:
getFailedTaskGroups
in interfaceITaskCollector
- Returns:
-
makeTaskGroup
public ITaskGroup makeTaskGroup(java.lang.String taskId, java.lang.Runnable r, java.util.List<ITaskGroup> children)
Description copied from interface:ITaskCollector
Add the given task to the task group- Specified by:
makeTaskGroup
in 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:ITaskCollector
Process the tasks, starting with the childless leaf tasks, waiting for everything to complete- Specified by:
startAndWait
in 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
-
-
-