T
- The type of the event or trigger.public abstract class EventJobBase<T> extends StructuralJob<java.lang.Object> implements java.util.function.Consumer<T>, Outbound<T>
childHelper, destroy, stop, structuralState
Constructor and Description |
---|
EventJobBase() |
Modifier and Type | Method and Description |
---|---|
void |
accept(T t) |
protected void |
execute()
Execute this job.
|
EventSource<T> |
getEventSource() |
protected StateOperator |
getInitialStateOp()
Subclasses must provide the
StateOperator that will decide
how to evaluate the children's state. |
java.util.function.Consumer<? super T> |
getTo() |
T |
getTrigger() |
boolean |
isBeDestination() |
protected abstract void |
onImmediateEvent(T event)
Do something with an event received immediately before the subscribe method has returned.
|
protected abstract void |
onLaterEvent(T event,
java.lang.Object job,
java.util.concurrent.Executor executor)
Called when an event is received after subscription.
|
protected void |
onStop()
Allow sub classes to do something on stop.
|
protected abstract void |
onSubscriptionStarted(java.lang.Object job,
java.util.concurrent.Executor executor)
Called once the subscription has started.
|
protected void |
postStop()
Subclasses can override to perform actions once children have stopped.
|
void |
setBeDestination(boolean beDestination) |
void |
setEventSource(EventSource<T> eventSource) |
void |
setExecutorService(java.util.concurrent.ExecutorService executorService) |
void |
setJobs(int index,
java.lang.Object child)
Add a child job.
|
void |
setTo(java.util.function.Consumer<? super T> destination)
Set the out bound destination.
|
protected void |
setTrigger(T trigger) |
protected void |
startChildStateReflector()
Start the child state reflector.
|
protected abstract StateListener |
stateOnChildComplete() |
protected void |
switchToChildStateReflector() |
protected void |
unsubscribe() |
addStructuralListener, fireDestroyedState, force, getStateChanger, hardReset, iconHelper, isStop, onDestroy, onHardReset, onReset, onSoftReset, removeStructuralListener, run, softReset, stateHandler, stop, stopChildStateReflector, waitForChildrenOnStop
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
@Inject public void setExecutorService(java.util.concurrent.ExecutorService executorService)
protected StateOperator getInitialStateOp()
StructuralJob
StateOperator
that will decide
how to evaluate the children's state.getInitialStateOp
in class StructuralJob<java.lang.Object>
protected void startChildStateReflector()
StructuralJob
startChildStateReflector
in class StructuralJob<java.lang.Object>
protected void execute() throws java.lang.Throwable
StructuralJob
execute
in class StructuralJob<java.lang.Object>
java.lang.Exception
- If the unexpected occurs.java.lang.Throwable
protected abstract void onImmediateEvent(T event)
event
- The event.protected abstract void onSubscriptionStarted(java.lang.Object job, java.util.concurrent.Executor executor)
job
- The job to execute if any.executor
- The executor to use to execute the job.protected abstract void onLaterEvent(T event, java.lang.Object job, java.util.concurrent.Executor executor)
onSubscriptionStarted(Object, Executor)
method,
implementors are responsible for their own synchronisation if required.event
- The event.protected abstract StateListener stateOnChildComplete()
protected void unsubscribe()
protected void switchToChildStateReflector()
protected void onStop()
StructuralJob
onStop
in class StructuralJob<java.lang.Object>
protected void postStop()
StructuralJob
postStop
in class StructuralJob<java.lang.Object>
public boolean isBeDestination()
public void setBeDestination(boolean beDestination)
public void setTo(java.util.function.Consumer<? super T> destination)
Outbound
public java.util.function.Consumer<? super T> getTo()
protected void setTrigger(T trigger)
public T getTrigger()
public EventSource<T> getEventSource()
public void setEventSource(EventSource<T> eventSource)
public void setJobs(int index, java.lang.Object child)
Property: jobs
Description: The child jobs.
Required: No, but pointless if missing.
child
- A child