org.oddjob.jobs.job
Class StopJob

java.lang.Object
  extended by org.oddjob.framework.BaseComponent
      extended by org.oddjob.framework.BasePrimary
          extended by org.oddjob.framework.SimpleJob
              extended by org.oddjob.framework.SerializableJob
                  extended by 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.
See Also:
Serialized Form
Author:
Rob Gordon

Field Summary
 
Fields inherited from class org.oddjob.framework.SimpleJob
stateHandler, stop
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Constructor Summary
StopJob()
           
 
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.BasePrimary
configure, getName, logger, logger, loggerName, save, setName, toString
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.Stoppable
stop
 
Methods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
 

Constructor Detail

StopJob

public StopJob()
Method Detail

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