Search in sources :

Example 1 with ListenerRegistry

use of org.onosproject.event.ListenerRegistry in project onos by opennetworkinglab.

the class VirtualListenerRegistryManager method process.

@Override
public void process(VirtualEvent event) {
    NetworkId networkId = event.networkId();
    Event originalEvent = (Event) event.subject();
    ListenerRegistry listenerRegistry = listenerMapByNetwork.get(networkId).get(originalEvent.getClass());
    if (listenerRegistry != null) {
        listenerRegistry.process(originalEvent);
        lastStart = listenerRegistry;
    }
}
Also used : ListenerRegistry(org.onosproject.event.ListenerRegistry) Event(org.onosproject.event.Event) NetworkId(org.onosproject.incubator.net.virtual.NetworkId)

Example 2 with ListenerRegistry

use of org.onosproject.event.ListenerRegistry in project onos by opennetworkinglab.

the class VirtualListenerRegistryManager method getRegistry.

public ListenerRegistry getRegistry(NetworkId networkId, Class<? extends Event> eventClass) {
    Map<Class<? extends Event>, ListenerRegistry> listenerMapByEvent = listenerMapByNetwork.get(networkId);
    if (listenerMapByEvent == null) {
        listenerMapByEvent = Maps.newConcurrentMap();
        listenerMapByNetwork.putIfAbsent(networkId, listenerMapByEvent);
    }
    ListenerRegistry listenerRegistry = listenerMapByEvent.get(eventClass);
    if (listenerRegistry == null) {
        listenerRegistry = new ListenerRegistry();
        listenerMapByEvent.putIfAbsent(eventClass, listenerRegistry);
    }
    return listenerRegistry;
}
Also used : ListenerRegistry(org.onosproject.event.ListenerRegistry) Event(org.onosproject.event.Event)

Aggregations

Event (org.onosproject.event.Event)2 ListenerRegistry (org.onosproject.event.ListenerRegistry)2 NetworkId (org.onosproject.incubator.net.virtual.NetworkId)1