Package adams.multiprocess
Class AbstractMetaJobRunner
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.multiprocess.AbstractJobRunner
-
- adams.multiprocess.AbstractMetaJobRunner
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,Pausable,QuickInfoSupporter,SizeOfHandler,JobRunner,Serializable
- Direct Known Subclasses:
RemoteCommandJobRunner,ScpJobRunner,ScpJobRunner.RemoteJobRunner,SerializingJobRunner
public abstract class AbstractMetaJobRunner extends AbstractJobRunner
Ancestor for meta-jobrunners, that wrap around a base jobrunner.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected JobRunnerm_ActualJobRunnerthe actual jobrunner.protected HashSet<JobCompleteListener>m_JobCompleteListenerscall when job complete.protected JobRunnerm_JobRunnerthe base jobrunner to use.protected List<Job>m_Jobsthe list of jobs.-
Fields inherited from class adams.multiprocess.AbstractJobRunner
m_FlowContext, m_Paused, m_Running, m_Terminating
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractMetaJobRunner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Job job)Adds the job to the execution queue.voidadd(JobList jobs)Adds the jobs to the execution queue.voidaddJobCompleteListener(JobCompleteListener l)Adds the listener.voidcleanUp()Cleans up data structures, frees up memory.voidclear()Clears all jobs.voiddefineOptions()Adds options to the internal list of options.protected JobRunnergetDefaultJobRunner()Returns the default jobrunner.JobRunnergetJobRunner()Returns the base jobrunner.List<T>getJobs()Returns the list of queued jobs.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.protected booleangetTransferJobCompleteListeners()Returns whether to transfer the listeners to the actual job runner.protected voidinitialize()Initializes the members.StringjobRunnerTipText()Returns the tip text for this property.protected JobRunnernewActualJobRunner()Returns an instance of the actual job runner to use.protected StringpreStart()Before actual start up.voidremoveJobCompleteListener(JobCompleteListener l)Removes the listener.voidsetJobRunner(JobRunner value)Sets the base jobrunner.-
Methods inherited from class adams.multiprocess.AbstractJobRunner
doStart, doStop, doTerminate, getFlowContext, isPaused, isRunning, pauseExecution, postStart, postStop, postTerminate, preStop, preTerminate, resumeExecution, setFlowContext, start, stop, terminate, terminate
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_JobRunner
protected JobRunner m_JobRunner
the base jobrunner to use.
-
m_JobCompleteListeners
protected transient HashSet<JobCompleteListener> m_JobCompleteListeners
call when job complete.
-
m_ActualJobRunner
protected JobRunner m_ActualJobRunner
the actual jobrunner.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractJobRunner
-
getDefaultJobRunner
protected JobRunner getDefaultJobRunner()
Returns the default jobrunner.- Returns:
- the jobrunner
-
setJobRunner
public void setJobRunner(JobRunner value)
Sets the base jobrunner.- Parameters:
value- the jobrunner
-
getJobRunner
public JobRunner getJobRunner()
Returns the base jobrunner.- Returns:
- the jobrunner
-
jobRunnerTipText
public String jobRunnerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Returns:
- null if no info available, otherwise short string
-
clear
public void clear()
Clears all jobs.
-
add
public void add(Job job)
Adds the job to the execution queue.- Parameters:
job- the job to add
-
add
public void add(JobList jobs)
Adds the jobs to the execution queue.- Parameters:
jobs- the jobs to add
-
addJobCompleteListener
public void addJobCompleteListener(JobCompleteListener l)
Adds the listener.- Parameters:
l- the listener to add
-
removeJobCompleteListener
public void removeJobCompleteListener(JobCompleteListener l)
Removes the listener.- Parameters:
l- the listener to remove
-
newActualJobRunner
protected JobRunner newActualJobRunner()
Returns an instance of the actual job runner to use.- Returns:
- the job runner to use
-
getTransferJobCompleteListeners
protected boolean getTransferJobCompleteListeners()
Returns whether to transfer the listeners to the actual job runner.- Returns:
- true if to transfer
- See Also:
addJobCompleteListener(JobCompleteListener),removeJobCompleteListener(JobCompleteListener)
-
preStart
protected String preStart()
Before actual start up.- Overrides:
preStartin classAbstractJobRunner- Returns:
- null if successful, otherwise error message
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUpin interfaceCleanUpHandler- Overrides:
cleanUpin classAbstractJobRunner
-
-