org.oddjob.jobs.job
Class StopJob
java.lang.Object
org.oddjob.framework.BaseComponent
org.oddjob.framework.BasePrimary
org.oddjob.framework.SimpleJob
org.oddjob.framework.SerializableJob
org.oddjob.jobs.job.StopJob
- All Implemented Interfaces:
- Serializable, Runnable, ArooaContextAware, ArooaSessionAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful, Stoppable
public class StopJob
- extends SerializableJob
- implements Stoppable
Description
A job which stops another job.
Normally The stop job will not complete until the job it is
stopping is in a not executing state. Therefore if the
stop job is attempting to stop a parent job of itself the stop
job could block indefinitely. This case is detected and the job
enters an Exception state.
Example
Examples elsewhere.
JMXClientJob
has an example where the stop
job is used to stop a client once the connection is no
longer needed.
- See Also:
- Serialized Form
- Author:
- Rob Gordon
Method Summary |
protected int |
execute()
Execute this job. |
Stoppable |
getJob()
Get the node to stop. |
protected void |
onStop()
Allow sub classes to do something on stop. |
void |
setJob(Stoppable node)
Set the stop node directly. |
Methods inherited from class org.oddjob.framework.SimpleJob |
fireDestroyedState, force, getStateChanger, hardReset, onDestroy, onReset, 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 |
StopJob
public StopJob()
setJob
public void setJob(Stoppable node)
- Set the stop node directly.
- Parameters:
node
- The node to stop.
getJob
public Stoppable getJob()
- Get the node to stop.
- Returns:
- The node.
execute
protected 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.
onStop
protected void onStop()
throws FailedToStopException
- Description copied from class:
SimpleJob
- Allow sub classes to do something on stop.
- Overrides:
onStop
in class SimpleJob
- Throws:
FailedToStopException