Class AbstractTask

    • Field Detail

      • cancelled

        protected volatile boolean cancelled
        If this is true, we should abort whatever the Task is currently doing in the run() method.
    • Constructor Detail

      • AbstractTask

        public AbstractTask()
    • Method Detail

      • setTaskIterator

        public final void setTaskIterator​(TaskIterator taskIterator)
        This method is used by a TaskIterator to set itself on the newly added Task. This method should not be called by otherwise.
        Parameters:
        taskIterator - TaskIterator that will set itself on the newly added task.
      • insertTasksAfterCurrentTask

        protected final void insertTasksAfterCurrentTask​(Task... newTasks)
        Inserts "newTasks" after the current Task, in the TaskIterator that is being managed by this class.
        Parameters:
        newTasks - tasks to insert after the current task in the TaskIterator that is being managed by this class.
      • insertTasksAfterCurrentTask

        protected final void insertTasksAfterCurrentTask​(TaskIterator newTasks)
        Inserts "newTasks" after the current Task, in the TaskIterator that is being managed by this class.
        Parameters:
        newTasks - the TaskIterator to insert after the current task in the TaskIterator that is being managed by this class.
      • run

        public abstract void run​(TaskMonitor taskMonitor)
                          throws Exception
        Description copied from interface: Task
        This method is called when the Task begins execution. This method should not be called by the programmer, as it will be called by the TaskManager.
        Specified by:
        run in interface Task
        Parameters:
        taskMonitor - The TaskMonitor provided by TaskManager. to allow the Task to modify its user interface.
        Throws:
        Exception - The Task is at liberty to throw an exception in run. The exception is caught by TaskManager and is displayed in the interface. If a Task does not throw an exception, the Task implementation does not need to specify the throws Exception clause for the run method. Moreover, exceptions should be the way the Task communicates the occurrence of a fatal error, like a low-level exception or an invalid parameter, to the TaskManager.
      • cancel

        public void cancel()
        Calling this attempts to abort the current Task. How well this works depends on the granularity of the implementing Task checking whether the "canceled" is true or not and then taking appropriate action.
        Specified by:
        cancel in interface Task