com.hammurapi.eventbus
Enum InferencePolicy

Show UML class diagram
java.lang.Object
  extended by java.lang.Enum<InferencePolicy>
      extended by com.hammurapi.eventbus.InferencePolicy
All Implemented Interfaces:
Serializable, Comparable<InferencePolicy>

public enum InferencePolicy
extends Enum<InferencePolicy>

Inference policy defines how new events (conclusions) posted by handlers are dispatched. Different policies provide different levels of serialization/concurrency of event processing.


Enum Constant Summary
AFTER_EVENT
          Conclusions are accumulated during event dispatching and are posted to the bus after all handlers for the current event finish execution.
AFTER_HANDLER
          Conclusions are accumulated during handler execution and are posted to the bus after the handler successfully finishes execution (without exception).
AFTER_ROOT_EVENT
          "Root event" is an event which is posted to the bus by the client code (not by a handler) through EventBus.post() method.
EXCLUSIVE
          Only one event at a time is dispatched by the bus.
IMMEDIATELY
          New events (conclusions) are dispatched immediately when they are posted.
 
Method Summary
static InferencePolicy valueOf(String name)
          Returns the enum constant of this type with the specified name.
static InferencePolicy[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

IMMEDIATELY

public static final InferencePolicy IMMEDIATELY
New events (conclusions) are dispatched immediately when they are posted. IMPORTANT: Use of this policy with join handlers may lead to ConcurrentModificationException if posted events match the same join handlers and inference commands are executed in the same thread.


AFTER_HANDLER

public static final InferencePolicy AFTER_HANDLER
Conclusions are accumulated during handler execution and are posted to the bus after the handler successfully finishes execution (without exception).


AFTER_EVENT

public static final InferencePolicy AFTER_EVENT
Conclusions are accumulated during event dispatching and are posted to the bus after all handlers for the current event finish execution.


AFTER_ROOT_EVENT

public static final InferencePolicy AFTER_ROOT_EVENT
"Root event" is an event which is posted to the bus by the client code (not by a handler) through EventBus.post() method. With this inference policy conclusions are accumulated and get posted to the bus after all handlers for the root event and previously posted conclusions finish execution.


EXCLUSIVE

public static final InferencePolicy EXCLUSIVE
Only one event at a time is dispatched by the bus. Handlers and predicates still execute in parallel by the executor service.

Method Detail

values

public static InferencePolicy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (InferencePolicy c : InferencePolicy.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static InferencePolicy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null