Package org.oddjob.state
Class JoinJob
- All Implemented Interfaces:
Serializable,Runnable,ArooaContextAware,ArooaSessionAware,Forceable,PropertyChangeNotifier,Iconic,LogEnabled,Resettable,Stateful,Stoppable,Structural
- Author:
- Rob Gordon
- See Also:
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>
-
Field Summary
Fields inherited from class org.oddjob.framework.extend.StructuralJob
childHelper, destroy, stop, structuralState -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecute()Execute this job.protected StateOperatorSubclasses must provide theStateOperatorthat will decide how to evaluate the children's state.longvoidSet the child job.voidsetTimeout(long timeout) Methods inherited from class org.oddjob.framework.extend.StructuralJob
addStructuralListener, fireDestroyedState, force, getStateChanger, hardReset, iconHelper, isStop, onDestroy, onHardReset, onReset, onSoftReset, onStop, postStop, removeStructuralListener, run, softReset, startChildStateReflector, stateHandler, stop, stopChildStateReflector, waitForChildrenOnStopMethods 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, 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
-
Constructor Details
-
JoinJob
public JoinJob()
-
-
Method Details
-
setJob
Set the child job.- Parameters:
child- A child- Reference Property:
- job
- Required:
- No, but pointless if missing.
Description
The child job. -
execute
Description copied from class:StructuralJobExecute this job.- Specified by:
executein classStructuralJob<Runnable>- Throws:
InterruptedException
-
getInitialStateOp
Description copied from class:StructuralJobSubclasses must provide theStateOperatorthat will decide how to evaluate the children's state.- Specified by:
getInitialStateOpin classStructuralJob<Runnable>- Returns:
- A State Operator. Must not be null.
-
getTimeout
public long getTimeout() -
setTimeout
public void setTimeout(long timeout)
-