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 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.
    • Constructor Detail

      • SerializingJobRunner

        public SerializingJobRunner()
    • Method Detail

      • 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:
        setNumAttempts in interface MultiAttemptSupporter
        Parameters:
        value - the maximum
      • getNumAttempts

        public int getNumAttempts()
        Returns the maximum number of intervals to wait.
        Specified by:
        getNumAttempts in interface MultiAttemptSupporter
        Returns:
        the maximum
      • numAttemptsTipText

        public String numAttemptsTipText()
        Returns the tip text for this property.
        Specified by:
        numAttemptsTipText in interface MultiAttemptSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • attemptIntervalTipText

        public String attemptIntervalTipText()
        Returns the tip text for this property.
        Specified by:
        attemptIntervalTipText in interface MultiAttemptWithWaitSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • doStop

        protected String doStop()
        Waits for the import file to appear.
        Specified by:
        doStop in class AbstractJobRunner
        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:
        doTerminate in class AbstractJobRunner
        Parameters:
        wait - whether to wait for the jobs to finish
        Returns:
        always null
      • complete

        public void complete​(Job j,
                             JobResult jr)
        Ignored.
        Specified by:
        complete in interface JobRunner
        Parameters:
        j - job
        jr - job result