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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal AtomicReference<Worker.Result>static final intfinal Scheduler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidrun()voidrunTask(WorkerTask toRun) voidsetCurrentTask(WorkerTask task) voidstop()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
-