Search in sources :

Example 1 with ListenerTracker

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

the class OpticalPathProvisioner method activate.

@Activate
protected void activate(ComponentContext context) {
    deviceService = opticalView(deviceService);
    appId = coreService.registerApplication("org.onosproject.newoptical");
    idCounter = storageService.getAtomicCounter(OPTICAL_CONNECTIVITY_ID_COUNTER);
    linkPathMap = storageService.<PacketLinkRealizedByOptical, OpticalConnectivity>consistentMapBuilder().withSerializer(Serializer.using(LINKPATH_SERIALIZER.build())).withName(LINKPATH_MAP_NAME).withApplicationId(appId).build();
    connectivityMap = storageService.<OpticalConnectivityId, OpticalConnectivity>consistentMapBuilder().withSerializer(Serializer.using(CONNECTIVITY_SERIALIZER.build())).withName(CONNECTIVITY_MAP_NAME).withApplicationId(appId).build();
    usedCrossConnectLinkSet = storageService.<Link>setBuilder().withSerializer(Serializer.using(CROSSCONNECTLINKS_SERIALIZER.build())).withName(CROSSCONNECTLINK_SET_NAME).withApplicationId(appId).build().asDistributedSet();
    eventDispatcher.addSink(OpticalPathEvent.class, listenerRegistry);
    listeners = new ListenerTracker();
    listeners.addListener(linkService, new InternalLinkListener()).addListener(intentService, new InternalIntentListener());
    linkPathMap.addListener(storeListener);
    readComponentConfiguration(context);
    log.info("Started");
}
Also used : ListenerTracker(org.onosproject.event.ListenerTracker) Link(org.onosproject.net.Link) Activate(org.osgi.service.component.annotations.Activate)

Example 2 with ListenerTracker

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

the class EventHistoryManager method activate.

@Activate
protected void activate() {
    appId = coreService.registerApplication("org.onosproject.events");
    log.debug("Registered as {}", appId);
    pruner = newSingleThreadScheduledExecutor(minPriority(groupedThreads("onos/events", "history-pruner", log)));
    pruner.scheduleWithFixedDelay(this::pruneEventHistoryTask, pruneInterval, pruneInterval, TimeUnit.SECONDS);
    listeners = new ListenerTracker();
    listeners.addListener(mastershipService, this::addEvent).addListener(deviceService, new InternalDeviceListener()).addListener(linkService, this::addEvent).addListener(topologyService, this::addEvent).addListener(hostService, this::addEvent).addListener(clusterService, this::addEvent).addListener(edgeService, this::addEvent).addListener(intentService, this::addEvent).addListener(netcfgService, this::addEvent);
    log.info("Started");
}
Also used : ListenerTracker(org.onosproject.event.ListenerTracker) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

ListenerTracker (org.onosproject.event.ListenerTracker)2 Activate (org.osgi.service.component.annotations.Activate)2 Link (org.onosproject.net.Link)1