com.hammurapi.eventbus
Interface Matcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>

Show UML class diagram
All Known Subinterfaces:
LocalMatcher<E,P,C,S>
All Known Implementing Classes:
LocalPredicateChainingMatcher, LocalSimpleMatcher, PredicateChainingMatcher

public interface Matcher<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>

Implementations of this interface match handlers to events.


Nested Class Summary
static interface Matcher.HandlerManager<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>
          Interface for live batch update of handlers.
 
Method Summary
 K addHandler(EventHandler<E,P,C,H,S> eventHandler)
          Adds handler to the matcher.
 void manageHandlers(Matcher.HandlerManager<E,P,C,K,H,S> handlerManager)
          This method is used for batch live updates of matcher handlers.
 Iterable<EventHandlerWrapper<E,P,C,K,H,S>> match(E event, ExecutorService executorService)
           
 void removeHandlers(Iterable<K> keys)
           
 void reset()
          Resets handler's state.
 void setEventBus(EventBus<E,P,C,K,H,S> bus)
          This method is invoked by the bus to provide a reference to self.
 void takeSnapshot(AbstractEventBus.Snapshot<E,P,C,K,H,S> snapshot)
          Takes matcher snapshot.
 

Method Detail

addHandler

K addHandler(EventHandler<E,P,C,H,S> eventHandler)
Adds handler to the matcher.

Parameters:
eventHandler -
Returns:

match

Iterable<EventHandlerWrapper<E,P,C,K,H,S>> match(E event,
                                                 ExecutorService executorService)
Parameters:
event -
executorService - Executor service to use for parallel matching.
Returns:
Handlers matching the event ordered by priority.

takeSnapshot

void takeSnapshot(AbstractEventBus.Snapshot<E,P,C,K,H,S> snapshot)
Takes matcher snapshot.

Parameters:
snapshot -

removeHandlers

void removeHandlers(Iterable<K> keys)

reset

void reset()
Resets handler's state.


manageHandlers

void manageHandlers(Matcher.HandlerManager<E,P,C,K,H,S> handlerManager)
This method is used for batch live updates of matcher handlers. The method acquires matcher write lock, then invokes matcher manager's manageHandlers() method within the lock and then releases the lock. Therefore, matcher structure update is executed as one logical unit.

Parameters:
handlerManager -

setEventBus

void setEventBus(EventBus<E,P,C,K,H,S> bus)
This method is invoked by the bus to provide a reference to self.

Parameters:
bus -