hu.netmind.beankeeper
Interface EventDispatcher


public interface EventDispatcher

Dispatches all events from the library internals to all registered listeners. Note: Implementations check for listeners who cause event loops, and temporary exclude these from event delivery to prevent endless loops.


Field Summary
static int PRI_HIGH
           
static int PRI_LOW
           
static int PRI_NORMAL
           
static int PRI_SYSTEM_HIGH
           
static int PRI_SYSTEM_LOW
           
 
Method Summary
 void notify(PersistenceEvent event)
          Notify all listeners of given event.
 boolean notifyAll(PersistenceEvent event)
          Notify all listeners in a guaranteed way.
 void registerListener(PersistenceEventListener listener)
          Register the given listener to this dispatcher.
 void registerListener(PersistenceEventListener listener, int priority)
          Register the given listener to this dispatcher with a priority.
 void unregisterListener(PersistenceEventListener listener)
          Remove the given listener from this dispatcher.
 

Field Detail

PRI_SYSTEM_LOW

static final int PRI_SYSTEM_LOW
See Also:
Constant Field Values

PRI_LOW

static final int PRI_LOW
See Also:
Constant Field Values

PRI_NORMAL

static final int PRI_NORMAL
See Also:
Constant Field Values

PRI_HIGH

static final int PRI_HIGH
See Also:
Constant Field Values

PRI_SYSTEM_HIGH

static final int PRI_SYSTEM_HIGH
See Also:
Constant Field Values
Method Detail

registerListener

void registerListener(PersistenceEventListener listener)
Register the given listener to this dispatcher.


registerListener

void registerListener(PersistenceEventListener listener,
                      int priority)
Register the given listener to this dispatcher with a priority.

Parameters:
priority - The priority of the listener. The lower the earlier the listener gets called. This has to be between PRI_LOW, and PRI_HIGH inclusive.

unregisterListener

void unregisterListener(PersistenceEventListener listener)
Remove the given listener from this dispatcher.


notify

void notify(PersistenceEvent event)
            throws java.lang.Exception
Notify all listeners of given event. This may not reach all event handlers, if there was an exception.

Throws:
java.lang.Exception - The event handlers' exception is forwarded as-is.

notifyAll

boolean notifyAll(PersistenceEvent event)
Notify all listeners in a guaranteed way. Exceptions that occur in the handlers will be logged, but not cause the event delivery to fail.

Returns:
True if the event delivery was a full success, false is one or more event handlers failed.