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 void
addListener(L listener)
Adds the specified listener.void
onProcessLimit()
Handles notification that event processing time limit has been exceeded.void
process(E event)
Processes the specified event.void
removeListener(L listener)
Removes the specified listener.protected void
reportProblem(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:ListenerService
Adds the specified listener.- Specified by:
addListener
in interfaceListenerService<E extends Event,L extends EventListener<E>>
- Parameters:
listener
- listener to be added
-
removeListener
public void removeListener(L listener)
Description copied from interface:ListenerService
Removes the specified listener.- Specified by:
removeListener
in interfaceListenerService<E extends Event,L extends EventListener<E>>
- Parameters:
listener
- listener to be removed
-
process
public void process(E event)
Description copied from interface:EventSink
Processes the specified event.
-
onProcessLimit
public void onProcessLimit()
Description copied from interface:EventSink
Handles notification that event processing time limit has been exceeded.- Specified by:
onProcessLimit
in interfaceEventSink<E extends Event>
-
-