Package org.onosproject.event
Class ListenerRegistry<E extends Event,L extends EventListener<E>>
- java.lang.Object
-
- org.onosproject.event.ListenerRegistry<E,L>
-
- All Implemented Interfaces:
EventSink<E>,ListenerService<E,L>
public class ListenerRegistry<E extends Event,L extends EventListener<E>> extends Object implements ListenerService<E,L>, EventSink<E>
Base implementation of an event sink and a registry capable of tracking listeners and dispatching events to them as part of event sink processing.
-
-
Constructor Summary
Constructors Constructor Description ListenerRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(L listener)Adds the specified listener.voidonProcessLimit()Handles notification that event processing time limit has been exceeded.voidprocess(E event)Processes the specified event.voidremoveListener(L listener)Removes the specified listener.protected voidreportProblem(E event, Throwable error)Reports a problem encountered while processing an event.
-
-
-
Field Detail
-
listeners
protected final Set<L extends EventListener<E>> listeners
Set of listeners that have registered.
-
-
Method Detail
-
addListener
public void addListener(L listener)
Description copied from interface:ListenerServiceAdds the specified listener.- Specified by:
addListenerin interfaceListenerService<E extends Event,L extends EventListener<E>>- Parameters:
listener- listener to be added
-
removeListener
public void removeListener(L listener)
Description copied from interface:ListenerServiceRemoves the specified listener.- Specified by:
removeListenerin interfaceListenerService<E extends Event,L extends EventListener<E>>- Parameters:
listener- listener to be removed
-
process
public void process(E event)
Description copied from interface:EventSinkProcesses the specified event.
-
onProcessLimit
public void onProcessLimit()
Description copied from interface:EventSinkHandles notification that event processing time limit has been exceeded.- Specified by:
onProcessLimitin interfaceEventSink<E extends Event>
-
-