public abstract class StructuralJob<E> extends BasePrimary implements java.lang.Runnable, java.io.Serializable, Stoppable, Resetable, Stateful, Forceable, Structural
Modifier and Type | Field and Description |
---|---|
protected ChildHelper<E> |
childHelper
Track changes to children an notify listeners.
|
protected boolean |
destroy |
protected boolean |
stop |
protected StructuralStateHelper |
structuralState
Calculate our state based on children.
|
Constructor and Description |
---|
StructuralJob()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addStructuralListener(StructuralListener listener)
Add a listener.
|
protected abstract void |
execute()
Execute this job.
|
protected void |
fireDestroyedState()
Internal method to fire state.
|
void |
force()
Force the job to COMPLETE.
|
protected abstract StateOperator |
getInitialStateOp()
Subclasses must provide the
StateOperator that will decide
how to evaluate the children's state. |
protected StateChanger<ParentState> |
getStateChanger() |
boolean |
hardReset()
Perform a hard reset on the job.
|
protected IconHelper |
iconHelper()
Subclasses must provide a
IconHelper . |
boolean |
isStop()
Expose the internal stop flag as a read only property.
|
protected void |
onDestroy()
Subclasses override this method to clear up resources.
|
protected void |
onHardReset()
Allow sub classes to do something on HARD reset.
|
protected void |
onReset()
Allow sub classes to do something on reset.
|
protected void |
onSoftReset()
Allow sub classes to do something on SOFT reset.
|
protected void |
onStop()
Allow sub classes to do something on stop.
|
protected void |
postStop()
Subclasses can override to perform actions once children have stopped.
|
void |
removeStructuralListener(StructuralListener listener)
Remove a listener.
|
void |
run()
Implement the main execute method for a job.
|
boolean |
softReset()
Perform a soft reset on the job.
|
protected void |
startChildStateReflector()
Start the child state reflector.
|
protected ParentStateHandler |
stateHandler()
Subclasses must provide a
StateHandler . |
void |
stop()
Implementation for a typical stop.
|
protected void |
stopChildStateReflector() |
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 ChildHelper<E> childHelper
protected transient volatile StructuralStateHelper structuralState
protected transient volatile boolean stop
Property:
Description: Read only view of the internal stop flag. This flag is cleared with a reset.
protected transient volatile boolean destroy
protected ParentStateHandler stateHandler()
BaseComponent
StateHandler
.stateHandler
in class BaseComponent
protected IconHelper iconHelper()
BaseComponent
IconHelper
.iconHelper
in class BaseComponent
protected final StateChanger<ParentState> getStateChanger()
protected abstract StateOperator getInitialStateOp()
StateOperator
that will decide
how to evaluate the children's state.protected abstract void 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 startChildStateReflector()
protected void stopChildStateReflector()
public void stop() throws FailedToStopException
This stop implementation doesn't check that the job is executing as stop messages must cascade down the hierarchy to manually started jobs.
stop
in interface Stoppable
FailedToStopException
protected void onStop() throws FailedToStopException
FailedToStopException
protected void postStop() throws FailedToStopException
FailedToStopException
public boolean softReset()
public boolean hardReset()
protected void onHardReset()
protected void onSoftReset()
protected void onReset()
public void addStructuralListener(StructuralListener listener)
addStructuralListener
in interface Structural
listener
- The listener.public void removeStructuralListener(StructuralListener listener)
removeStructuralListener
in interface Structural
listener
- The listener.public boolean isStop()
protected void onDestroy()
BaseComponent
onDestroy
in class BaseComponent
protected void fireDestroyedState()
fireDestroyedState
in class BaseComponent