Package org.onosproject.event
Class AbstractListenerManager<E extends Event,L extends EventListener<E>>
- java.lang.Object
-
- org.onosproject.event.AbstractListenerManager<E,L>
-
- All Implemented Interfaces:
ListenerService<E,L>
public abstract class AbstractListenerManager<E extends Event,L extends EventListener<E>> extends Object implements ListenerService<E,L>
Basis for components which need to export listener mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description protected EventDeliveryService
eventDispatcher
protected ListenerRegistry<E,L>
listenerRegistry
-
Constructor Summary
Constructors Constructor Description AbstractListenerManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(L listener)
Adds the specified listener.protected void
post(E event)
Safely posts the specified event to the local event dispatcher.void
removeListener(L listener)
Removes the specified listener.
-
-
-
Field Detail
-
listenerRegistry
protected final ListenerRegistry<E extends Event,L extends EventListener<E>> listenerRegistry
-
eventDispatcher
protected EventDeliveryService eventDispatcher
-
-
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
-
post
protected void post(E event)
Safely posts the specified event to the local event dispatcher. If there is no event dispatcher or if the event is null, this method is a noop.- Parameters:
event
- event to be posted; may be null
-
-