Package org.onosproject.net.provider
Class AbstractListenerProviderRegistry<E extends Event,L extends EventListener<E>,P extends Provider,S extends ProviderService<P>>
- java.lang.Object
-
- org.onosproject.net.provider.AbstractProviderRegistry<P,S>
-
- org.onosproject.net.provider.AbstractListenerProviderRegistry<E,L,P,S>
-
- All Implemented Interfaces:
ListenerService<E,L>
,ProviderRegistry<P,S>
public abstract class AbstractListenerProviderRegistry<E extends Event,L extends EventListener<E>,P extends Provider,S extends ProviderService<P>> extends AbstractProviderRegistry<P,S> 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 AbstractListenerProviderRegistry()
-
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.-
Methods inherited from class org.onosproject.net.provider.AbstractProviderRegistry
createProviderService, defaultProvider, getProvider, getProvider, getProvider, getProviders, register, unregister
-
-
-
-
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
-
-