Package nz.org.riskscape.engine.sched
Class Scheduler
java.lang.Object
nz.org.riskscape.engine.sched.Scheduler
- All Implemented Interfaces:
Runnable
The Scheduler oversees the execution of the pipeline tasks. Mostly this involves assigning WorkerTasks to the Worker threads.
TODO rename methods called by scheduler thread to make it clearer
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionScheduler
(nz.org.riskscape.engine.sched.SchedulerParams params, nz.org.riskscape.problem.ProblemSink problemSink) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Future<nz.org.riskscape.engine.pipeline.ExecutionResult>
queueJob
(nz.org.riskscape.engine.output.PipelineJobContext context) void
run()
void
stop
(boolean join) Stop the scheduler from scheduling more workvoid
Notifies the scheduler that a task has finished running for now.
-
Field Details
-
MAX_WAIT_MILLISECS
public static final int MAX_WAIT_MILLISECS- See Also:
-
-
Constructor Details
-
Scheduler
public Scheduler(nz.org.riskscape.engine.sched.SchedulerParams params, nz.org.riskscape.problem.ProblemSink problemSink)
-
-
Method Details
-
run
public void run() -
allTasksComplete
public boolean allTasksComplete() -
stop
public void stop(boolean join) Stop the scheduler from scheduling more work
- Parameters:
join
- if true, this method will only return once all threads have ended. This can block if any workers are blocked, but otherwise should return fairly promptly
-
workerFinished
public void workerFinished()Notifies the scheduler that a task has finished running for now. This doesn't necessarily mean the task is complete - it may have stopped because it's blocked waiting on input or output. But the worker thread is now idle and can start processing another task.
-
queueJob
public Future<nz.org.riskscape.engine.pipeline.ExecutionResult> queueJob(nz.org.riskscape.engine.output.PipelineJobContext context) -
getWaitingTasks
-
getRunningTasks
-
getCompletedTasks
-