Class AbstractJobRunner<T extends Job>

    • Field Detail

      • m_Running

        protected boolean m_Running
        whether the jobs are being executed.
      • m_Paused

        protected boolean m_Paused
        whether the execution is paused.
      • m_FlowContext

        protected transient Actor m_FlowContext
        the flow context.
    • Constructor Detail

      • AbstractJobRunner

        public AbstractJobRunner()
    • Method Detail

      • setFlowContext

        public void setFlowContext​(Actor value)
        Sets the flow context, if any.
        Specified by:
        setFlowContext in interface JobRunner<T extends Job>
        Parameters:
        value - the context
      • getFlowContext

        public Actor getFlowContext()
        Return the flow context, if any.
        Specified by:
        getFlowContext in interface JobRunner<T extends Job>
        Returns:
        the context, null if none available
      • preStart

        protected String preStart()
        Before actual start up.
        Default implementation does nothing.
        Returns:
        null if successful, otherwise error message
      • doStart

        protected abstract String doStart()
        Performing actual start up. Only gets executed if preStart() was successful.
        Returns:
        null if successful, otherwise error message
        See Also:
        preStart()
      • postStart

        protected String postStart()
        After actual start up. Only gets executed if preStart() was successful.
        Default implementation does nothing.
        Returns:
        null if successful, otherwise error message
      • start

        public void start()
        Starts the execution of jobs.
        Specified by:
        start in interface JobRunner<T extends Job>
      • preStop

        protected String preStop()
        Before actual stop.
        Default implementation does nothing
        Returns:
        null if successful, otherwise error message
      • doStop

        protected abstract String doStop()
        Performing actual stop.
        Returns:
        null if successful, otherwise error message
      • postStop

        protected String postStop()
        After actual stop.
        Returns:
        null if successful, otherwise error message
      • stop

        public void stop()
        Stops the execution after all currently queued jobs have been executed.
        Specified by:
        stop in interface JobRunner<T extends Job>
      • preTerminate

        protected String preTerminate()
        Before actual terminate up.
        Default implementation does nothing
        Returns:
        null if successful, otherwise error message
      • doTerminate

        protected abstract String doTerminate​(boolean wait)
        Performing actual terminate up.
        Parameters:
        wait - whether to wait for the jobs to finish
        Returns:
        null if successful, otherwise error message
      • postTerminate

        protected String postTerminate()
        After actual terminate up.
        Returns:
        null if successful, otherwise error message
      • terminate

        public void terminate()
        Stops the execution immediately. Waits for the jobs to finish.
        Specified by:
        terminate in interface JobRunner<T extends Job>
      • terminate

        public void terminate​(boolean wait)
        Stops the execution immediately.
        Specified by:
        terminate in interface JobRunner<T extends Job>
        Parameters:
        wait - whether to wait for the jobs to finish
      • isRunning

        public boolean isRunning()
        Returns whether the job are being executed.
        Specified by:
        isRunning in interface JobRunner<T extends Job>
        Returns:
        true if jobs are being executed
      • isPaused

        public boolean isPaused()
        Returns whether the object is currently paused.
        Specified by:
        isPaused in interface JobRunner<T extends Job>
        Specified by:
        isPaused in interface Pausable
        Returns:
        true if object is paused
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Default implementation does nothing.
        Specified by:
        cleanUp in interface CleanUpHandler