Package org.oddjob.jobs.job
Class StopJob
- All Implemented Interfaces:
Serializable,Runnable,ArooaContextAware,ArooaSessionAware,Forceable,PropertyChangeNotifier,Iconic,LogEnabled,Resettable,Stateful,Stoppable
- Author:
- Rob Gordon
- See Also:
JMXClientJobhas an example where the stop job is used to stop a client once the connection is no longer needed.
Description
A job which stops another job.Normally The stop job will not complete until the job it is stopping is in a stopped state, however if the stop job is attempting tos stop a parent of itself (and therefore itself) then this stop job will detect this and stop. It will therefore complete even if thing it is trying to stop hasn't fully stopped.
Example
Examples elsewhere.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNumber of seconds to wait for a stop result. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intexecute()Execute this job.getJob()Get the node to stop.protected voidonStop()Allow sub classes to do something on stop.voidsetExecutorService(ExecutorService executorService) voidSet the stop node directly.Methods inherited from class org.oddjob.framework.extend.SimpleJob
fireDestroyedState, force, getStateChanger, hardReset, iconHelper, isStop, onDestroy, onReset, run, sleep, softReset, stateHandler, stopMethods 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
-
Field Details
-
RESULT_POLL_TIMEOUT
public static final int RESULT_POLL_TIMEOUTNumber of seconds to wait for a stop result.- See Also:
-
-
Constructor Details
-
StopJob
public StopJob()
-
-
Method Details
-
setExecutorService
-
setJob
Set the stop node directly.- Parameters:
node- The node to stop.
-
getJob
Get the node to stop.- Returns:
- The node.
-
execute
Description copied from class:SimpleJobExecute this job. -
onStop
Description copied from class:SimpleJobAllow sub classes to do something on stop.- Overrides:
onStopin classSimpleJob- Throws:
FailedToStopException
-