Package nz.org.riskscape.engine.sched
Class Worker
java.lang.Object
nz.org.riskscape.engine.sched.Worker
- All Implemented Interfaces:
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.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionfinal AtomicReference<Worker.Result>
static final int
final Scheduler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
run()
void
runTask
(WorkerTask toRun) void
setCurrentTask
(WorkerTask task) void
stop()
Stop the Worker (once it completes any task currently in progress).toString()
-
Field Details
-
lastResult
-
owner
-
MAX_WAIT_MILLISECS
public static final int MAX_WAIT_MILLISECS- See Also:
-
-
Constructor Details
-
Worker
-
-
Method Details
-
isRunning
public boolean isRunning()- Returns:
- true if the Worker is currently busy running a task
-
clearLastTask
-
setCurrentTask
-
runTask
-
run
public void run() -
stop
public void stop()Stop the Worker (once it completes any task currently in progress).
-
toString
-