org.oddjob.jobs
Class WaitJob
java.lang.Object
org.oddjob.framework.BaseComponent
org.oddjob.framework.BasePrimary
org.oddjob.framework.SimpleJob
org.oddjob.jobs.WaitJob
- All Implemented Interfaces:
- Runnable, ArooaContextAware, ArooaSessionAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful, Stoppable
public class WaitJob
- extends SimpleJob
- implements Stoppable
Description
This Job will either wait a given number of milliseconds
or will wait for a property or job to become available.
If the for property is provided, then the delay is used as the number of
milliseconds between checking if the property is available.
Example
The ExecutorThrottleType
has a simple example.Example
This example waits for a variable 'text' to be set. The value could be set
across the network or by a another job running in parallel.
<sequential name="Waiting For a Property">
<jobs>
<variables id="waitvars"/>
<wait name="Wait for Variable" for="${waitvars.text}" pause="2000"/>
<echo name="Echo Text">${waitvars.text}</echo>
</jobs>
</sequential>
- Author:
- Rob Gordon
Methods inherited from class org.oddjob.framework.SimpleJob |
fireDestroyedState, force, getStateChanger, hardReset, onDestroy, onReset, onStop, run, sleep, softReset, 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 |
WaitJob
public WaitJob()
setPause
public void setPause(long delay)
- Set the delay time in milli seconds.
- Parameters:
delay
- The delay time.
getPause
public long getPause()
- Get the delay time in milli seconds.
- Returns:
- The delay time.
execute
public int execute()
throws Exception
- Description copied from class:
SimpleJob
- Execute this job.
- Specified by:
execute
in class SimpleJob
- Returns:
- 0 if the job is complete, anything else otherwise.
- Throws:
Exception
- If the unexpected occurs.
simpleWait
protected void simpleWait()
waitFor
protected void waitFor()
waitForState
protected void waitForState()
getFor
public Object getFor()
setFor
public void setFor(Object forProperty)
getState
public StateCondition getState()
setState
public void setState(StateCondition state)