org.oddjob.state
Class CascadeJob
java.lang.Object
org.oddjob.framework.BaseComponent
org.oddjob.framework.BasePrimary
org.oddjob.framework.StructuralJob<Runnable>
org.oddjob.state.CascadeJob
- All Implemented Interfaces:
- Serializable, Runnable, ArooaContextAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful, Stoppable, Structural
public class CascadeJob
- extends StructuralJob<Runnable>
Description
A job which triggers the next job after the previous one completes.
This job differs from a SequentialJob task in that the latter
follows the thread of execution, and only checks state to ensure
it can continue. This job's thread of execution passes onwards after the
cascade has been set up. This job will complete asynchronously once all
it's children have completed.
Example
A cascade of two jobs.
<oddjob>
<job>
<state:cascade xmlns:state="http://rgordon.co.uk/oddjob/state">
<jobs>
<echo>This runs first.</echo>
<echo>Then this.</echo>
</jobs>
</state:cascade>
</job>
</oddjob>
- See Also:
- Serialized Form
- Author:
- Rob Gordon
| Methods inherited from class org.oddjob.framework.BaseComponent |
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSession |
CascadeJob
public CascadeJob()
setExecutorService
@Inject
public void setExecutorService(ExecutorService executor)
setJobs
public void setJobs(int index,
Runnable child)
- Add a child job.
Property: jobs
Description: The child jobs.
Required: No, but pointless if missing.
- Parameters:
child - A child
execute
protected void execute()
throws InterruptedException
- Description copied from class:
StructuralJob
- Execute this job.
- Specified by:
execute in class StructuralJob<Runnable>
- Throws:
InterruptedException
onStop
protected void onStop()
- Description copied from class:
StructuralJob
- Allow sub classes to do something on stop.
- Overrides:
onStop in class StructuralJob<Runnable>
getStateOp
protected StateOperator getStateOp()
- Specified by:
getStateOp in class StructuralJob<Runnable>
addStructuralListener
public void addStructuralListener(StructuralListener listener)
- Description copied from class:
StructuralJob
- Add a listener. The listener will immediately receive add
notifications for all existing children.
- Specified by:
addStructuralListener in interface Structural- Overrides:
addStructuralListener in class StructuralJob<Runnable>
- Parameters:
listener - The listener.
removeStructuralListener
public void removeStructuralListener(StructuralListener listener)
- Description copied from class:
StructuralJob
- Remove a listener.
- Specified by:
removeStructuralListener in interface Structural- Overrides:
removeStructuralListener in class StructuralJob<Runnable>
- Parameters:
listener - The listener.
startChildStateReflector
protected void startChildStateReflector()
- Overrides:
startChildStateReflector in class StructuralJob<Runnable>