Package org.oddjob.jobs
Class GrabJob
java.lang.Object
org.oddjob.framework.extend.BaseComponent
org.oddjob.framework.extend.BasePrimary
org.oddjob.jobs.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.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStructuralListener(StructuralListener listener) Add a listener.protected voidInternal method to fire state.protected StateChanger<JobState> booleanPerform a hard reset on the job.protected IconHelperSubclasses must provide aIconHelper.voidremoveStructuralListener(StructuralListener listener) Remove a listener.final voidrun()voidsetIdentifier(String identifier) voidsetInstance(Object instance) voidThe child.voidvoidsetOnLoosing(GrabJob.LoosingAction loosingAction) booleanPerform a soft reset on the job.protected JobStateHandlerSubclasses must provide aStateHandler.voidstop()Stop executing.Methods inherited from class org.oddjob.framework.extend.BasePrimary
configure, getName, logger, logger, loggerName, save, setName, toStringMethods inherited from class org.oddjob.framework.extend.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onDestroy, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSessionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
-
Field Details
-
stop
protected transient volatile boolean stopstop flag.
-
-
Constructor Details
-
GrabJob
public GrabJob()Constructor.
-
-
Method Details
-
stateHandler
Description copied from class:BaseComponentSubclasses must provide aStateHandler.- Specified by:
stateHandlerin classBaseComponent- Returns:
- A State Handler. Never null.
-
iconHelper
Description copied from class:BaseComponentSubclasses must provide aIconHelper.- Specified by:
iconHelperin classBaseComponent- Returns:
- An Icon Helper. Never null.
-
getStateChanger
-
run
public final void run() -
stop
Description copied from interface:StoppableStop executing. This method should not return until the Stoppable has actually stopped.- Specified by:
stopin interfaceStoppable- Throws:
FailedToStopException
-
softReset
public boolean softReset()Perform a soft reset on the job.- Specified by:
softResetin interfaceResettable- Returns:
- true if successful.
-
hardReset
public boolean hardReset()Perform a hard reset on the job.- Specified by:
hardResetin interfaceResettable- Returns:
- true if successful.
-
addStructuralListener
Add a listener. The listener will immediately receive add notifications for all existing children.- Specified by:
addStructuralListenerin interfaceStructural- Parameters:
listener- The listener.
-
removeStructuralListener
Remove a listener.- Specified by:
removeStructuralListenerin interfaceStructural- Parameters:
listener- The listener.
-
setJob
The child.- Parameters:
job- A child- Reference Property:
- job
- Required:
- No, but pointless if missing.
Description
The child job. -
setKeeper
-
getIdentifier
-
setIdentifier
-
getInstance
-
setInstance
-
getWinner
-
getOnLoosing
-
setOnLoosing
-
fireDestroyedState
protected void fireDestroyedState()Internal method to fire state.- Specified by:
fireDestroyedStatein classBaseComponent
-