Class 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 the ExecutorService 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 the ITaskGroup 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 group
      void startAndWait()
      Process the tasks, starting with the childless leaf tasks, waiting for everything to complete
      void submit​(TaskGroup tg)
      Submit the task group to the pool
      void taskComplete​(TaskGroup tg)
      Callback from each task group made when it completes
      void taskFailed​(TaskGroup tg)
      Receipt of a signal from the task group that it has failed.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TaskManager

        public TaskManager​(java.util.concurrent.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 java.util.Collection<ITaskGroup> getFailedTaskGroups()
        Description copied from interface: ITaskCollector
        Return a list of all the ITaskGroup 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 interface ITaskCollector
        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 interface ITaskCollector
        Parameters:
        taskId - the parent to tell when we're done. Can be null
        r - 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 interface ITaskCollector
      • 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 -