Class BlockingTaskManager

  • All Implemented Interfaces:
    TaskManager

    public class BlockingTaskManager
    extends Object
    implements TaskManager
    Implements a simple task manager suitable for non-Swing applications that runs a task as soon as it is submitted and does not return until the task is complete.
    • Constructor Detail

      • BlockingTaskManager

        public BlockingTaskManager()
    • Method Detail

      • submit

        public void submit​(Task task)
        Description copied from interface: TaskManager
        Submits a task to run in the background.
        Specified by:
        submit in interface TaskManager
        Parameters:
        task - the task to run
      • remove

        public void remove​(Task task)
        Description copied from interface: TaskManager
        Removes a task from the task manager. The task manager will attempt to cancel the task if it is running. Once a task is removed, further operations on the task using this task manager may result in exceptions.
        Specified by:
        remove in interface TaskManager
        Parameters:
        task - the task to remove
      • getStatus

        public Task.Status getStatus​(Task task)
        Description copied from interface: TaskManager
        Gets the task status.
        Specified by:
        getStatus in interface TaskManager
        Parameters:
        task - the task
        Returns:
        the task status
      • cancel

        public void cancel​(Task task)
        Description copied from interface: TaskManager
        Requests to cancel the task.
        Specified by:
        cancel in interface TaskManager
        Parameters:
        task - the task to cancel