Package adams.multiprocess
Interface JobRunner<T extends Job>
-
- All Superinterfaces:
CleanUpHandler
,Destroyable
,OptionHandler
,Pausable
,QuickInfoSupporter
- All Known Implementing Classes:
AbstractJobRunner
,AbstractMetaJobRunner
,LocalJobRunner
,RemoteCommandJobRunner
,ScpJobRunner
,ScpJobRunner.RemoteJobRunner
,SerializingJobRunner
public interface JobRunner<T extends Job> extends Pausable, OptionHandler, CleanUpHandler, QuickInfoSupporter
Interface for runners that execute jobs.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(JobList<T> jobs)
Adds the jobs to the execution queue.void
add(T job)
Adds the job to the execution queue.void
addJobCompleteListener(JobCompleteListener l)
Adds the listener.void
clear()
Clears all jobs.void
complete(T j, JobResult jr)
Job is complete, so check for more to add..Actor
getFlowContext()
Return the flow context, if any.List<T>
getJobs()
Returns the list of queued jobs.boolean
isPaused()
Returns whether the object is currently paused.boolean
isRunning()
Returns whether the job are being executed.void
pauseExecution()
Pauses the execution.void
removeJobCompleteListener(JobCompleteListener l)
Removes the listener.void
resumeExecution()
Resumes the execution.void
setFlowContext(Actor value)
Sets the flow context, if any.void
start()
Starts the execution of jobs.void
stop()
Stops the execution after all currently queued jobs have been executed.void
terminate()
Stops the execution immediately.void
terminate(boolean wait)
Stops the execution immediately.-
Methods inherited from interface adams.core.CleanUpHandler
cleanUp
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
Methods inherited from interface adams.core.QuickInfoSupporter
getQuickInfo
-
-
-
-
Method Detail
-
addJobCompleteListener
void addJobCompleteListener(JobCompleteListener l)
Adds the listener.- Parameters:
l
- the listener to add
-
removeJobCompleteListener
void removeJobCompleteListener(JobCompleteListener l)
Removes the listener.- Parameters:
l
- the listener to remove
-
clear
void clear()
Clears all jobs.
-
add
void add(T job)
Adds the job to the execution queue.- Parameters:
job
- the job to add
-
add
void add(JobList<T> jobs)
Adds the jobs to the execution queue.- Parameters:
jobs
- the jobs to add
-
start
void start()
Starts the execution of jobs.
-
stop
void stop()
Stops the execution after all currently queued jobs have been executed.
-
terminate
void terminate()
Stops the execution immediately. Waits for the jobs to finish.
-
terminate
void terminate(boolean wait)
Stops the execution immediately.- Parameters:
wait
- whether to wait for the jobs to finish
-
complete
void complete(T j, JobResult jr)
Job is complete, so check for more to add..- Parameters:
j
- jobjr
- job result
-
isRunning
boolean isRunning()
Returns whether the job are being executed.- Returns:
- true if jobs are being executed
-
pauseExecution
void pauseExecution()
Pauses the execution.- Specified by:
pauseExecution
in interfacePausable
-
isPaused
boolean isPaused()
Returns whether the object is currently paused.
-
resumeExecution
void resumeExecution()
Resumes the execution.- Specified by:
resumeExecution
in interfacePausable
-
setFlowContext
void setFlowContext(Actor value)
Sets the flow context, if any.- Parameters:
value
- the context
-
getFlowContext
Actor getFlowContext()
Return the flow context, if any.- Returns:
- the context, null if none available
-
-