Modifier and type | Property and description |
---|---|
InternalSchedules | executor Replies the agent's task scheduler that must be used by the event bus. |
Constructor and description |
---|
new(Supplier<T>,IBehaviorGuardEvaluatorRegistry,Provider<T>) Instantiates a dispatcher. |
Modifier and type | Action and description |
---|---|
void | asyncDispatch(Event,[Logger]) Posts an event to all registered BehaviorGuardEvaluator . |
void | asyncDispatchTo(Object,Event,[Logger]) Posts an event to the registered BehaviorGuardEvaluator of the given listener only. |
protected java.util.Collection<E> | evaluateGuards(Event,ConcurrentCollection<T>,Logger) Evaluate the guard associated to the specified event and returns the list of behaviors methods that must be executed. |
protected void | executeAsynchronouslyBehaviorMethods(Collection<E>) Execute every single Behaviors runnable, a dedicated thread will created by the executor local to this class and be used to execute each runnable in parallel. |
protected void | executeBehaviorMethodsInParalellWithSynchroAtTheEnd(Collection<E>,boolean,Logger) Execute every single Behaviors runnable, a dedicated thread will created by the executor local to this class and be used to execute each runnable in parallel, and this method waits until its future has been completed before leaving. |
InternalSchedules | getExecutor Replies the agent's task scheduler that must be used by the event bus. |
ConcurrentCollection<T> | getRegisteredEventListeners(Class<T>) Extract the registered listeners with the given type. |
boolean | hasRegisteredEventListener(Class<T>) Replies if a listener with the given type is registered. |
void | immediateDispatch(Event,boolean,[Logger]) Posts an event to all registered BehaviorGuardEvaluator . |
void | immediateDispatchTo(Object,Event,boolean,[Logger]) Posts an event to the registered BehaviorGuardEvaluator of the given listener only. |
void | register(Object,Function1<Param,Result>,Procedure1<Param>) Registers all PerceptGuardEvaluator methods on object to receive events. |
void | unregister(Class<T>,Function1<Param,Result>) Unregisters all PerceptGuardEvaluator methods on the objects of the given type. |
void | unregister(Object,Procedure1<Param>) Unregisters all PerceptGuardEvaluator methods on a registered object . |
void | unregisterAll(Function1<Param,Result>) Unregisters all PerceptGuardEvaluator methods on all registered objects. |
val executor : InternalSchedules
This property is an alias for the action: getExecutor
new(Supplier<T>,IBehaviorGuardEvaluatorRegistry,Provider<T>)
def asyncDispatch(Event,[Logger])
BehaviorGuardEvaluator
. The dispatch of this event will be done asynchronously. This method will return successfully after the event has been posted to all BehaviorGuardEvaluator
, and regardless of any exceptions thrown by BehaviorGuardEvaluator
.
def asyncDispatchTo(Object,Event,[Logger])
BehaviorGuardEvaluator
of the given listener only. The dispatch of this event will be done asynchronously. This method will return successfully after the event has been posted to all BehaviorGuardEvaluator
, and regardless of any exceptions thrown by BehaviorGuardEvaluator
.
protected def evaluateGuards(Event,ConcurrentCollection<T>,Logger) : java.util.Collection<E>
event
and returns the list of behaviors methods that must be executed.
Errors are logger by the executor service. But they are not stopping the call to this function.
protected def executeAsynchronouslyBehaviorMethods(Collection<E>)
protected def executeBehaviorMethodsInParalellWithSynchroAtTheEnd(Collection<E>,boolean,Logger)
def getExecutor : InternalSchedules
def getRegisteredEventListeners(Class<T>) : ConcurrentCollection<T>with T
def hasRegisteredEventListener(Class<T>) : boolean
def immediateDispatch(Event,boolean,[Logger])
BehaviorGuardEvaluator
. The dispatch of the events within the agent is asynchronous. A rendez-vous point is set up in order to wait for all the event handlers to be finished. This method will return successfully after the event has been posted to all BehaviorGuardEvaluator
, and regardless of any exceptions thrown by BehaviorGuardEvaluator
.
def immediateDispatchTo(Object,Event,boolean,[Logger])
BehaviorGuardEvaluator
of the given listener only. The dispatch of this event will be done synchronously. This method will return successfully after the event has been posted to all BehaviorGuardEvaluator
, and regardless of any exceptions thrown by BehaviorGuardEvaluator
.
def register(Object,Function1<Param,Result>,Procedure1<Param>)
PerceptGuardEvaluator
methods on object
to receive events.
If the filter is provided, it will be used for determining if the given behavior accepts a specific event. If the filter function replies true
for a specific event as argument, the event is fired in the behavior context. If the filter function replies false
, the event is not fired in the behavior context.
def unregister(Class<T>,Function1<Param,Result>)
PerceptGuardEvaluator
methods on the objects of the given type.
def unregister(Object,Procedure1<Param>)
PerceptGuardEvaluator
methods on a registered object
.
def unregisterAll(Function1<Param,Result>)
PerceptGuardEvaluator
methods on all registered objects.