@Beta
@NotThreadSafe
public class ListenerTracker
extends java.lang.Object
Usage Example:
private ListenerTracker listeners;@Activate
protected void activate() { listeners = new ListenerTracker(); listeners.addListener(mastershipService, new InternalMastershipListener()) .addListener(deviceService, new InternalDeviceListener()) .addListener(linkService, new InternalLinkListener()) .addListener(topologyService, new InternalTopologyListener()) .addListener(hostService, new InternalHostListener()); }@Deactivate
protected void deactivate() { listeners.removeListeners(); }
Constructor and Description |
---|
ListenerTracker() |
Modifier and Type | Method and Description |
---|---|
<E extends Event<?,?>,L extends EventListener<E>> |
addListener(ListenerService<E,L> service,
L listener)
Adds
EventListener to specified ListenerService . |
void |
removeListeners()
Removes all listeners in reverse order they have been registered.
|
public <E extends Event<?,?>,L extends EventListener<E>> ListenerTracker addListener(ListenerService<E,L> service, L listener)
EventListener
to specified ListenerService
.E
- eventL
- listenerservice
- ListenerService
listener
- EventListener
public void removeListeners()