Class Job


  • public abstract class Job
    extends Worker
    Synchronously executes a series of Tasks in order.
    Author:
    M. Togna, S. Ricci
    • Constructor Detail

      • Job

        public Job()
    • Method Detail

      • abort

        public void abort()
        Overrides:
        abort in class Worker
      • buildTasks

        protected abstract void buildTasks()
                                    throws Throwable
        Creates and adds tasks to this job.
        Throws:
        Throwable
      • createTask

        protected <T extends Worker> T createTask​(Class<T> type)
      • hasTaskToRun

        protected boolean hasTaskToRun()
      • nextTask

        protected Worker nextTask()
      • addTask

        protected <T extends Worker> T addTask​(Class<T> type)
        Creates and adds a task of the specified type.
        Parameters:
        type -
        Returns:
      • addTask

        protected <T extends Worker> void addTask​(T task)
        Throws IllegalStateException if invoked after run() is called
        Parameters:
        task -
      • addTasks

        protected <C extends Collection<? extends Worker>> void addTasks​(C tasks)
      • onTaskCompleted

        protected void onTaskCompleted​(Worker task)
        Called when the task ends its execution with the status Worker.Status.COMPLETED
        Parameters:
        task -
      • initializeTask

        protected void initializeTask​(Worker task)
        Called before task execution.
        Parameters:
        task -
      • release

        public void release()
        Description copied from class: Worker
        Releases the resource used during the execution
        Overrides:
        release in class Worker
      • getCurrentTaskIndex

        public int getCurrentTaskIndex()
      • getCurrentTask

        public Worker getCurrentTask()
      • getJobManager

        public JobManager getJobManager()
      • setJobManager

        public void setJobManager​(JobManager jobManager)