Class Worker

java.lang.Object
nz.org.riskscape.engine.sched.Worker
All Implemented Interfaces:
Runnable

public class Worker extends Object implements Runnable

The Worker represents a thread that can run tasks. It gets assigned a WorkerTask by the Scheduler and runs the task until it is either complete, there's no more input available, or its output buffer is full. The result of the task is then passed back to the Scheduler.

  • Field Details

  • Constructor Details

    • Worker

      public Worker(int id, Scheduler owner)
  • Method Details

    • isRunning

      public boolean isRunning()
      Returns:
      true if the Worker is currently busy running a task
    • clearLastTask

      public Worker.Result clearLastTask()
    • setCurrentTask

      public void setCurrentTask(WorkerTask task)
    • runTask

      public void runTask(WorkerTask toRun)
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • stop

      public void stop()

      Stop the Worker (once it completes any task currently in progress).

    • toString

      public String toString()
      Overrides:
      toString in class Object