public abstract class SimpleJob extends BasePrimary implements java.lang.Runnable, Resetable, Stateful, Forceable
Modifier and Type | Field and Description |
---|---|
protected boolean |
stop |
Modifier | Constructor and Description |
---|---|
protected |
SimpleJob() |
Modifier and Type | Method and Description |
---|---|
protected abstract int |
execute()
Execute this job.
|
protected void |
fireDestroyedState()
Internal method to fire state.
|
void |
force()
Force the job to COMPLETE.
|
protected StateChanger<JobState> |
getStateChanger() |
boolean |
hardReset()
Perform a hard reset on the job.
|
protected IconHelper |
iconHelper()
Subclasses must provide a
IconHelper . |
boolean |
isStop()
Getter for stop flag.
|
protected void |
onDestroy()
Subclasses override this method to clear up resources.
|
protected void |
onReset()
Allow sub classes to do something on reset.
|
protected void |
onStop()
Allow sub classes to do something on stop.
|
void |
run()
Implement the main execute method for a job.
|
protected void |
sleep(long waitTime)
Utility method to sleep a certain time.
|
boolean |
softReset()
Perform a soft reset on the job.
|
protected JobStateHandler |
stateHandler()
Subclasses must provide a
StateHandler . |
void |
stop()
Allow subclasses to indicate they are
stopping.
|
configure, getName, logger, logger, loggerName, save, setName, toString
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSession
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addStateListener, lastStateEvent, removeStateListener
protected transient volatile boolean stop
Property:
Description: This flag is set by the stop method and should be examined by any Stoppable jobs in their processing loops.
Required: Read Only.
protected JobStateHandler stateHandler()
BaseComponent
StateHandler
.stateHandler
in class BaseComponent
protected IconHelper iconHelper()
BaseComponent
IconHelper
.iconHelper
in class BaseComponent
protected StateChanger<JobState> getStateChanger()
protected abstract int execute() throws java.lang.Throwable
java.lang.Exception
- If the unexpected occurs.java.lang.Throwable
public final void run()
run
in interface java.lang.Runnable
protected void sleep(long waitTime)
waitTime
- Milliseconds to sleep for.public final void stop() throws FailedToStopException
FailedToStopException
protected void onStop() throws FailedToStopException
FailedToStopException
public boolean isStop()
public boolean softReset()
public boolean hardReset()
protected void onReset()
protected void onDestroy()
BaseComponent
onDestroy
in class BaseComponent
protected void fireDestroyedState()
fireDestroyedState
in class BaseComponent