Class GrabJob

All Implemented Interfaces:
Serializable, Runnable, ArooaContextAware, ArooaSessionAware, PropertyChangeNotifier, Iconic, LogEnabled, Resettable, Stateful, Stoppable, Structural

public class GrabJob extends BasePrimary implements Runnable, Serializable, Stoppable, Resettable, Stateful, Structural
Author:
rob
See Also:

Description

Grab work to do. By competing for work with other Grabbers this job facilitates distribution of work between multiple Oddjob processes.

Example

See the user guide.
  • Field Details

    • stop

      protected transient volatile boolean stop
      stop flag.
  • Constructor Details

    • GrabJob

      public GrabJob()
      Constructor.
  • Method Details

    • stateHandler

      protected JobStateHandler 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<JobState> getStateChanger()
    • run

      public final void run()
      Specified by:
      run in interface Runnable
    • stop

      public void stop() throws FailedToStopException
      Description copied from interface: Stoppable
      Stop executing. This method should not return until the Stoppable has actually stopped.
      Specified by:
      stop in interface Stoppable
      Throws:
      FailedToStopException
    • 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.
    • addStructuralListener

      public void addStructuralListener(StructuralListener listener)
      Add a listener. The listener will immediately receive 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 listener.
    • setJob

      public void setJob(Runnable job)
      The child.
      Parameters:
      job - A child
      Reference Property:
      job

      Description

      The child job.
      Required:
      No, but pointless if missing.
    • setKeeper

      public void setKeeper(Keeper keeper)
    • getIdentifier

      public String getIdentifier()
    • setIdentifier

      public void setIdentifier(String identifier)
    • getInstance

      public Object getInstance()
    • setInstance

      public void setInstance(Object instance)
    • getWinner

      public String getWinner()
    • getOnLoosing

      public GrabJob.LoosingAction getOnLoosing()
    • setOnLoosing

      public void setOnLoosing(GrabJob.LoosingAction loosingAction)
    • fireDestroyedState

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