Package adams.multiprocess
Class SerializingJobRunner
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,MultiAttemptSupporter,MultiAttemptWithWaitSupporter,OptionHandler,Pausable,QuickInfoSupporter,SizeOfHandler,JobRunner,Serializable
public class SerializingJobRunner extends AbstractMetaJobRunner implements MultiAttemptWithWaitSupporter
Wraps another jobrunner and serializes it to the specified export file and then waits for the specified import file (containing the serialized, executed jobs) to appear.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-job-runner <adams.multiprocess.JobRunner> (property: jobRunner) The base jobrunner to use. default: adams.multiprocess.LocalJobRunner
-export <adams.core.io.PlaceholderFile> (property: export) The file to serialize the un-executed jobs to. default: ${CWD}-import <adams.core.io.PlaceholderFile> (property: import) The file to deserialize the executed jobs from. default: ${CWD}-max-attempts <int> (property: numAttempts) The maximum number of intervals to wait. default: 10 minimum: 1
-attempt-nterval <int> (property: attemptInterval) The interval in milli-seconds to wait before continuing with the execution. default: 100 minimum: 1
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_AttemptIntervalthe interval in milli-seconds to wait.protected PlaceholderFilem_Exportthe file to serialize the unexecuted jobs to.protected PlaceholderFilem_Importthe file to deserialize the finished jobs from.protected intm_NumAttemptsthe maximum number of interval to wait.-
Fields inherited from class adams.multiprocess.AbstractMetaJobRunner
m_ActualJobRunner, m_JobCompleteListeners, m_JobRunner, m_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 SerializingJobRunner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringattemptIntervalTipText()Returns the tip text for this property.voidcomplete(Job j, JobResult jr)Ignored.voiddefineOptions()Adds options to the internal list of options.protected StringdoStart()Serializes the jobs to the specified export file.protected StringdoStop()Waits for the import file to appear.protected StringdoTerminate(boolean wait)Has no influence on the actual execution of the jobs.StringexportTipText()Returns the tip text for this property.intgetAttemptInterval()Returns the interval to wait in milli-seconds.protected PlaceholderFilegetDefaultExport()Returns the default export file.protected PlaceholderFilegetDefaultImport()Returns the default import file.PlaceholderFilegetExport()Returns the file to export the un-executed jobs to.PlaceholderFilegetImport()Returns the file to import the executed jobs from.intgetNumAttempts()Returns the maximum number of intervals to wait.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringglobalInfo()Returns a string describing the object.StringimportTipText()Returns the tip text for this property.StringnumAttemptsTipText()Returns the tip text for this property.voidsetAttemptInterval(int value)Sets the interval in milli-seconds to wait.voidsetExport(PlaceholderFile value)Sets the file to export the un-executed jobs to.voidsetImport(PlaceholderFile value)Sets the file to import the executed jobs from.voidsetNumAttempts(int value)Sets the maximum number of intervals to wait.-
Methods inherited from class adams.multiprocess.AbstractMetaJobRunner
add, add, addJobCompleteListener, cleanUp, clear, getDefaultJobRunner, getJobRunner, getJobs, getTransferJobCompleteListeners, initialize, jobRunnerTipText, newActualJobRunner, preStart, removeJobCompleteListener, setJobRunner
-
Methods inherited from class adams.multiprocess.AbstractJobRunner
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, 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_Export
protected PlaceholderFile m_Export
the file to serialize the unexecuted jobs to.
-
m_Import
protected PlaceholderFile m_Import
the file to deserialize the finished jobs from.
-
m_NumAttempts
protected int m_NumAttempts
the maximum number of interval to wait.
-
m_AttemptInterval
protected int m_AttemptInterval
the interval in milli-seconds to wait.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractMetaJobRunner
-
getDefaultExport
protected PlaceholderFile getDefaultExport()
Returns the default export file.- Returns:
- the export file
-
setExport
public void setExport(PlaceholderFile value)
Sets the file to export the un-executed jobs to.- Parameters:
value- the export file
-
getExport
public PlaceholderFile getExport()
Returns the file to export the un-executed jobs to.- Returns:
- the export file
-
exportTipText
public String exportTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultImport
protected PlaceholderFile getDefaultImport()
Returns the default import file.- Returns:
- the import file
-
setImport
public void setImport(PlaceholderFile value)
Sets the file to import the executed jobs from.- Parameters:
value- the import file
-
getImport
public PlaceholderFile getImport()
Returns the file to import the executed jobs from.- Returns:
- the import file
-
importTipText
public String importTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNumAttempts
public void setNumAttempts(int value)
Sets the maximum number of intervals to wait.- Specified by:
setNumAttemptsin interfaceMultiAttemptSupporter- Parameters:
value- the maximum
-
getNumAttempts
public int getNumAttempts()
Returns the maximum number of intervals to wait.- Specified by:
getNumAttemptsin interfaceMultiAttemptSupporter- Returns:
- the maximum
-
numAttemptsTipText
public String numAttemptsTipText()
Returns the tip text for this property.- Specified by:
numAttemptsTipTextin interfaceMultiAttemptSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAttemptInterval
public void setAttemptInterval(int value)
Sets the interval in milli-seconds to wait.- Specified by:
setAttemptIntervalin interfaceMultiAttemptWithWaitSupporter- Parameters:
value- the interval
-
getAttemptInterval
public int getAttemptInterval()
Returns the interval to wait in milli-seconds.- Specified by:
getAttemptIntervalin interfaceMultiAttemptWithWaitSupporter- Returns:
- the interval
-
attemptIntervalTipText
public String attemptIntervalTipText()
Returns the tip text for this property.- Specified by:
attemptIntervalTipTextin interfaceMultiAttemptWithWaitSupporter- 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.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractMetaJobRunner- Returns:
- null if no info available, otherwise short string
-
doStart
protected String doStart()
Serializes the jobs to the specified export file.- Specified by:
doStartin classAbstractJobRunner- Returns:
- null if successful, otherwise error message
- See Also:
AbstractJobRunner.preStart()
-
doStop
protected String doStop()
Waits for the import file to appear.- Specified by:
doStopin classAbstractJobRunner- Returns:
- null if successful, otherwise error message
-
doTerminate
protected String doTerminate(boolean wait)
Has no influence on the actual execution of the jobs.- Specified by:
doTerminatein classAbstractJobRunner- Parameters:
wait- whether to wait for the jobs to finish- Returns:
- always null
-
-