org.oddjob.state
Class JoinJob
java.lang.Object
org.oddjob.framework.BaseComponent
org.oddjob.framework.BasePrimary
org.oddjob.framework.StructuralJob<Runnable>
org.oddjob.state.JoinJob
- All Implemented Interfaces:
- Serializable, Runnable, ArooaContextAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful, Stoppable, Structural
public class JoinJob
- extends StructuralJob<Runnable>
Description
Waits for a COMPLETE state from it's child job before allowing
the thread of execution to continue.
Example
An join that waits for two triggers. In this example another trigger
to run the last job might be a better solution because it wouldn't hog
a thread - but there are situations when join is just simpler.
<oddjob>
<job>
<sequential>
<jobs>
<folder>
<jobs>
<state:flag id="apples" xmlns:state="http://rgordon.co.uk/oddjob/state"/>
<state:flag id="oranges" xmlns:state="http://rgordon.co.uk/oddjob/state"/>
</jobs>
</folder>
<state:join id="our-join" xmlns:state="http://rgordon.co.uk/oddjob/state">
<job>
<sequential>
<jobs>
<scheduling:trigger on="${apples}" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling">
<job>
<echo>Apples</echo>
</job>
</scheduling:trigger>
<scheduling:trigger on="${oranges}" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling">
<job>
<echo>Oranges</echo>
</job>
</scheduling:trigger>
</jobs>
</sequential>
</job>
</state:join>
<echo id="last-job">And that's that!</echo>
</jobs>
</sequential>
</job>
</oddjob>
- See Also:
- Serialized Form
- Author:
- Rob Gordon
| Methods inherited from class org.oddjob.framework.StructuralJob |
addStructuralListener, fireDestroyedState, force, getStateChanger, hardReset, onDestroy, onReset, onStop, removeStructuralListener, run, softReset, startChildStateReflector, stateHandler, stop |
| 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 |
JoinJob
public JoinJob()
setJob
public void setJob(Runnable child)
- Set the child job.
Property: job
Description: The child job.
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
getStateOp
protected StateOperator getStateOp()
- Specified by:
getStateOp in class StructuralJob<Runnable>