Skip navigation links


com.fatwire.cs.core.event
Interface EventDispatcher<E extends Event,R extends ListenerRegistry>

All Known Implementing Classes:
SimpleDispatcher

public interface EventDispatcher<E extends Event,R extends ListenerRegistry>

This interface abstracts the function of dispatching an event to one or many Listeners. ListenerRegistry is injected as a dependency, the registry is to be used for discovering registered Listeners. Listener modes: Listeners are registered to be invoked in blocking and non-blocking modes. Invoking blocking Listeners must cause the dispatcher to wait until Listener returns. That is, dispatchEvent must not return until blocking Listeners are executed completely. It is generally adviced to execute all blocking Listenrs in the same thread that dispatcher was notified in. Not doing so will have transaction and visibility restrictions, so please use such techniques in well understood cases. All non-blocking Listeners are to be invoked in a non-blokcing fashion, that is dispatchEvent() returns right away. In either case, implementation decides the order of invocation and timeouts (if any). Implementations also decide queuing and what happens to queued Listeners when they are subsequenly unregistered.


Method Summary
 void dispatchEvent(E e)
          Dispatches the event to regisreted Listeners (See Listener modes for discussion on the intended behavior of this method).
 void setRegistry(R reg)
          Sets (injects) a ListenerRegistry to be used for discovering Listeners.

 

Method Detail

dispatchEvent

void dispatchEvent(E e)
                   throws EventException
Dispatches the event to regisreted Listeners (See Listener modes for discussion on the intended behavior of this method).
Parameters:
e - Event to be dispatched
Throws:
EventException - if the dispatch

setRegistry

void setRegistry(R reg)
Sets (injects) a ListenerRegistry to be used for discovering Listeners.
Parameters:
reg -

Skip navigation links


Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.