Class ScheduleBase

All Implemented Interfaces:
Serializable, Runnable, ArooaContextAware, ArooaSessionAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resettable, Stateful, Stoppable, Structural
Direct Known Subclasses:
TimerBase, Trigger

public abstract class ScheduleBase extends BasePrimary implements Runnable, Stoppable, Serializable, Resettable, Stateful, Structural, Forceable
Common functionality for jobs that schedule things.
Author:
Rob Gordon
See Also:
  • Field Details

    • stateHandler

      protected transient volatile TimerStateHandler stateHandler
      Fires state events.
    • childHelper

      protected transient volatile ChildHelper<Runnable> childHelper
      Track the child.
    • childStateReflector

      protected transient volatile StateExchange<TimerState> childStateReflector
    • stop

      protected transient volatile boolean stop
      Stop flag.
    • begun

      protected transient volatile CountDownLatch begun
  • Constructor Details

    • ScheduleBase

      public ScheduleBase()
      Default Constructor.
  • Method Details

    • stateHandler

      protected TimerStateHandler stateHandler()
      Description copied from class: BaseComponent
      Subclasses must provide a StateHandler.
      Specified by:
      stateHandler in class BaseComponent
      Returns:
      A State Handler. Never null.
    • iconHelper

      protected IconHelper iconHelper()
      Description copied from class: BaseComponent
      Subclasses must provide a IconHelper.
      Specified by:
      iconHelper in class BaseComponent
      Returns:
      An Icon Helper. Never null.
    • getStateChanger

      protected StateChanger<TimerState> getStateChanger()
    • getStateOp

      protected abstract StateOperator getStateOp()
      Sub classes provide the state operator that is used to calculate the subclasses completion state.
      Returns:
      The operator. Must not be null.
    • begin

      protected abstract void begin() throws ComponentPersistException
      Sub classes must override this to submit the first execution.
      Throws:
      ComponentPersistException - If the scheduled time can't be saved.
    • run

      public final void run()
      Implement the main execute method for a job. This surrounds the doExecute method of the sub class and sets state for the job.
      Specified by:
      run in interface Runnable
    • stop

      public final void stop() throws FailedToStopException
      Implementation for a typical stop. Subclasses must implement Stoppable to take advantage of it.

      This stop implementation doesn't check that the job is executing as stop messages must cascade down the hierarchy to manually started jobs.

      Specified by:
      stop in interface Stoppable
      Throws:
      FailedToStopException
    • onStop

      protected void onStop()
      Subclasses can override to perform stopping operations.
    • postStop

      protected void postStop()
      Subclasses can override to perform actions once children have stopped.
    • softReset

      public boolean softReset()
      Perform a soft reset on the job.
      Specified by:
      softReset in interface Resettable
      Returns:
      true if successful.
    • hardReset

      public boolean hardReset()
      Perform a hard reset on the job.
      Specified by:
      hardReset in interface Resettable
      Returns:
      true if successful.
    • onReset

      protected void onReset()
      Override by subclasses to reset state.
    • force

      public void force()
      Description copied from interface: Forceable
      Force something. Generally this will be the state of a job to COMPLETE but other uses may be found.
      Specified by:
      force in interface Forceable
    • addStructuralListener

      public void addStructuralListener(StructuralListener listener)
      Add a listener. The listener will immediately recieve add notifications for all existing children.
      Specified by:
      addStructuralListener in interface Structural
      Parameters:
      listener - The listener.
    • removeStructuralListener

      public void removeStructuralListener(StructuralListener listener)
      Remove a listener.
      Specified by:
      removeStructuralListener in interface Structural
      Parameters:
      listener - The listner.
    • onDestroy

      protected void onDestroy()
      Description copied from class: BaseComponent
      Subclasses override this method to clear up resources. This is called by the framework before child elements have been destroyed.
      Overrides:
      onDestroy in class BaseComponent
    • fireDestroyedState

      protected void fireDestroyedState()
      Internal method to fire state.
      Specified by:
      fireDestroyedState in class BaseComponent