Class AbstractTask

  • All Implemented Interfaces:
    Task
    Direct Known Subclasses:
    AsyncTask, ContainerTask, SyncTask

    public abstract class AbstractTask
    extends Object
    implements Task
    AbstractTask - Currently a collection of 'dependency' tasks defines the set of tasks that are dependents of another. - When a task completes, the set of dependency tasks are the ones that need to be considered to be run. - When a task is considered, it removes the just-completed prerequisite task from its 'prerequisites' list i.e. the set of tasks that must complete before it can run. - If the set of prerequisites for the task becomes empty, then the task can be run.
    Author:
    Seth, brozow
    • Method Detail

      • doSubmit

        protected void doSubmit()
        This method submits a task to be executed and is called when all dependencies are completed for that task This method should place a runnable on an executor or submit the task in some other way so that it will run as soon as possible. Tasks that have no processing to be done may override completeSubmit to notify the Task coordinator that the task is done.
      • completeSubmit

        protected void completeSubmit()
        This method exists to allow a task to have no processing
      • schedule

        public final void schedule()
        This is called to add the task to the queue of tasks that can be considered to be runnable
        Specified by:
        schedule in interface Task
      • preSchedule

        protected void preSchedule()

        preSchedule

      • postSchedule

        protected void postSchedule()

        postSchedule

      • isScheduled

        protected final boolean isScheduled()
        This task has be sent to the TaskCoordinator to be run
        Returns:
        a boolean.
      • addPrerequisite

        protected void addPrerequisite​(AbstractTask prereq)
        Adds prereq as a Prerequisite of this task. In other words, this task cannot run until prereq has been completed.
        Parameters:
        prereq - a AbstractTask object.
      • addDependent

        protected final void addDependent​(AbstractTask dependent)
        Adds dependent as a dependent of this task. The dependent will not be able to run until this task has been completed. TODO: Unused?
        Parameters:
        dependent - a AbstractTask object.