Bug 1073: Added support to DOMBrokerImpl for Transaction Chaining
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / NotificationModule.java
index 8c272e5a4c8a957b64bcf2d6b139d7e10c8ed8c3..b298a02a633cda2760347417266bb4d06e48dbca 100644 (file)
@@ -9,14 +9,13 @@ package org.opendaylight.controller.sal.dom.broker;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.controller.sal.core.api.Consumer.ConsumerFunctionality;
 import org.opendaylight.controller.sal.core.api.Provider.ProviderFunctionality;
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
@@ -37,7 +36,7 @@ public class NotificationModule implements BrokerModule {
     private static Logger log = LoggerFactory
             .getLogger(NotificationModule.class);
 
-    private Multimap<QName, NotificationListener> listeners = HashMultimap
+    private final Multimap<QName, NotificationListener> listeners = HashMultimap
             .create();
 
     private static final Set<Class<? extends BrokerService>> PROVIDED_SERVICE_TYPE = ImmutableSet
@@ -83,7 +82,7 @@ public class NotificationModule implements BrokerModule {
     private void sendNotification(CompositeNode notification) {
         QName type = notification.getNodeType();
         Collection<NotificationListener> toNotify = listeners.get(type);
-        log.info("Publishing notification " + type);
+        log.trace("Publishing notification " + type);
 
         if (toNotify == null) {
             // No listeners were registered - returns.
@@ -114,11 +113,12 @@ public class NotificationModule implements BrokerModule {
     private class NotificationConsumerSessionImpl implements
             NotificationService {
 
-        private Multimap<QName, NotificationListener> consumerListeners = HashMultimap
+        private final Multimap<QName, NotificationListener> consumerListeners = HashMultimap
                 .create();
         private boolean closed = false;
 
-    
+
+        @Override
         public Registration<NotificationListener> addNotificationListener(QName notification,
                 NotificationListener listener) {
             checkSessionState();
@@ -132,7 +132,7 @@ public class NotificationModule implements BrokerModule {
 
             consumerListeners.put(notification, listener);
             listeners.put(notification, listener);
-            log.info("Registered listener for notification: " + notification);
+            log.trace("Registered listener for notification: " + notification);
             return null; // Return registration Object.
         }
 
@@ -171,18 +171,13 @@ public class NotificationModule implements BrokerModule {
             NotificationPublishService {
 
         @Override
-        public void sendNotification(CompositeNode notification) {
+        public void publish(CompositeNode notification) {
             checkSessionState();
             if (notification == null)
                 throw new IllegalArgumentException(
                         "Notification must not be null.");
             NotificationModule.this.sendNotification(notification);
         }
-
-        @Override
-        public void publish(CompositeNode notification) {
-            sendNotification(notification);
-        }
     }
 
     @Override