fix sonar issues 56/19956/1
authorMichal Cmarada <mcmarada@cisco.com>
Tue, 4 Jun 2019 13:57:23 +0000 (15:57 +0200)
committerMichal Cmarada <mcmarada@cisco.com>
Tue, 4 Jun 2019 13:57:23 +0000 (15:57 +0200)
Change-Id: I9c121df82f392f71a21b9ac25c15e7e77071aa25
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombNotificationManagerProvider.java
infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfNotificationMapperProvider.java

index 7acfae6..0578a34 100644 (file)
@@ -39,6 +39,8 @@ public final class HoneycombNotificationManagerProvider extends ProviderTrait<No
     @Inject
     private BindingToNormalizedNodeCodec codec;
 
+    private NotificationProducerTracker notificationProducerTracker;
+
     @Override
     protected HoneycombNotificationCollector create() {
         // Create the registry to keep track of what'OPERATIONAL registered
@@ -55,7 +57,7 @@ public final class HoneycombNotificationManagerProvider extends ProviderTrait<No
                         notificationProducerRegistry);
 
         // Create tracker, responsible for starting and stopping registered notification producers whenever necessary
-        NotificationProducerTracker notificationProducerTracker =
+        notificationProducerTracker =
                 new NotificationProducerTracker(notificationProducerRegistry, honeycombNotificationCollector,
                         notificationRouter);
 
index 9289936..15af3b4 100644 (file)
@@ -57,6 +57,8 @@ public class NetconfNotificationMapperProvider extends ProviderTrait<NetconfOper
     @Inject
     private ShutdownHandler shutdownHandler;
 
+    private CapabilityChangeNotificationProducer capabilityChangeNotificationProducer;
+
     @Override
     protected NetconfNotificationOperationServiceFactory create() {
         LOG.trace("Initializing NotificationToMdsalWriter");
@@ -64,16 +66,15 @@ public class NetconfNotificationMapperProvider extends ProviderTrait<NetconfOper
         writer.start();
 
         LOG.trace("Initializing CapabilityChangeNotificationProducer");
-        final CapabilityChangeNotificationProducer capabilityChangeNotificationProducer =
-            new CapabilityChangeNotificationProducer(notificationCollector, dataBroker);
+        capabilityChangeNotificationProducer =
+                new CapabilityChangeNotificationProducer(notificationCollector, dataBroker);
 
         LOG.trace("Providing NetconfNotificationOperationServiceFactory");
         final NetconfNotificationOperationServiceFactory netconfNotificationOperationServiceFactory =
             new NetconfNotificationOperationServiceFactory(notificationRegistry, aggregator);
 
         shutdownHandler.register("netconf-notification-service-factory", netconfNotificationOperationServiceFactory);
-        shutdownHandler.register("capability-change-notification-producer",
-            capabilityChangeNotificationProducer::close);
+        shutdownHandler.register("capability-change-notification-producer", capabilityChangeNotificationProducer);
         shutdownHandler.register("notification-to-mdsal-writer", writer);
         return netconfNotificationOperationServiceFactory;
     }