Package org.bgerp.app.event
Class EventProcessor
java.lang.Object
org.bgerp.app.event.EventProcessor
- Direct Known Subclasses:
EventProcessor
Event processor, implementing Singleton and Observable patterns.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
processEvent
(Event event, ConnectionSet conSet) Processes an event with registered listeners.static <E extends Event>
voidsubscribe
(EventListener<? super E> l, Class<E> clazz) Subscribes a listener to events of a class.static <E extends Event>
voidsubscribe
(EventListener<? super E> l, Class<E> clazz, int priority) Subscribes a listener to events of a class.static void
unsubscribe
(EventListener<?> l) Unsubscribes a listener from all events.
-
Constructor Details
-
EventProcessor
public EventProcessor()
-
-
Method Details
-
subscribe
Subscribes a listener to events of a class.- Parameters:
l
- the listener.clazz
- the event class.
-
subscribe
public static <E extends Event> void subscribe(EventListener<? super E> l, Class<E> clazz, int priority) Subscribes a listener to events of a class.- Parameters:
l
- the listener.clazz
- the event class.priority
- the listener's priority, high priority listeners process events earlier.
-
unsubscribe
Unsubscribes a listener from all events.- Parameters:
l
- the listener.
-
processEvent
Processes an event with registered listeners.- Parameters:
event
- the event.conSet
- a DB connections set.- Throws:
BGMessageException
Exception
-