Merge "increased test coverage"
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / impl / NotificationBrokerImpl.xtend
index e8b3850b77b665113b3bac0d9e33c8029cc592fc..b4fd6b67712d6054b2f74737d89f3ea091aa9345 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration
 import org.opendaylight.yangtools.concepts.Registration\r
 import org.opendaylight.yangtools.yang.binding.Notification\r
 import org.slf4j.LoggerFactory\r
+import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder\r
 \r
 class NotificationBrokerImpl implements NotificationProviderService, AutoCloseable {\r
 \r
@@ -29,6 +30,11 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab
     @Property\r
     var ExecutorService executor;\r
 \r
+    new() {\r
+        listeners = HashMultimap.create()\r
+    }\r
+\r
+    @Deprecated\r
     new(ExecutorService executor) {\r
         listeners = HashMultimap.create()\r
         this.executor = executor;\r
@@ -100,7 +106,7 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab
 \r
     override registerNotificationListener(\r
         org.opendaylight.yangtools.yang.binding.NotificationListener listener) {\r
-        val invoker = BindingAwareBrokerImpl.generator.invokerFactory.invokerFor(listener);\r
+        val invoker = SingletonHolder.INVOKER_FACTORY.invokerFor(listener);\r
         for (notifyType : invoker.supportedNotifications) {\r
             listeners.put(notifyType, invoker.invocationProxy)\r
         }\r
@@ -169,14 +175,24 @@ class NotifyTask implements Callable<Object> {
 \r
     private static val log = LoggerFactory.getLogger(NotifyTask);\r
 \r
+    @SuppressWarnings("rawtypes")\r
     val NotificationListener listener;\r
     val Notification notification;\r
 \r
     override call() {\r
+        //Only logging the complete notification in debug mode\r
         try {\r
-            log.info("Delivering notification {} to {}",notification,listener);\r
+            if(log.isDebugEnabled){\r
+                log.debug("Delivering notification {} to {}",notification,listener);\r
+            } else {\r
+                log.info("Delivering notification {} to {}",notification.class.name,listener);\r
+            }\r
             listener.onNotification(notification);\r
-            log.info("Notification delivered {} to {}",notification,listener);\r
+            if(log.isDebugEnabled){\r
+                log.debug("Notification delivered {} to {}",notification,listener);\r
+            } else {\r
+                log.info("Notification delivered {} to {}",notification.class.name,listener);\r
+            }\r
         } catch (Exception e) {\r
             log.error("Unhandled exception thrown by listener: {}", listener, e);\r
         }\r