Incorrect connect API is called in ConnectionMgr when NodeType is provided
[controller.git] / opendaylight / sal / connection / implementation / src / main / java / org / opendaylight / controller / sal / connection / implementation / internal / ConnectionService.java
index 1c7e2c05e65f54d28a6560b7c62daa5054104046..7bd15ff7f45c2aa56bfde10a4878ac55371fc533 100644 (file)
@@ -8,10 +8,7 @@
 
 package org.opendaylight.controller.sal.connection.implementation.internal;
 
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
-import java.util.Collections;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -114,7 +111,9 @@ public class ConnectionService implements IPluginOutConnectionService, IConnecti
     @Override
     public Node connect (String type, String connectionIdentifier, Map<ConnectionConstants, String> params) {
         IPluginInConnectionService s = pluginService.get(type);
-        if (s != null) return s.connect(connectionIdentifier, params);
+        if (s != null) {
+            return s.connect(connectionIdentifier, params);
+        }
         return null;
     }
 
@@ -124,7 +123,9 @@ public class ConnectionService implements IPluginOutConnectionService, IConnecti
             for (String pluginType : this.pluginService.keySet()) {
                 IPluginInConnectionService s = pluginService.get(pluginType);
                 Node node = s.connect(connectionIdentifier, params);
-                if (node != null) return node;
+                if (node != null) {
+                    return node;
+                }
             }
         }
         return null;
@@ -153,9 +154,9 @@ public class ConnectionService implements IPluginOutConnectionService, IConnecti
      */
     @Override
     public void notifyNodeDisconnectFromMaster(Node node) {
-        for (String pluginType : this.pluginService.keySet()) {
-            IPluginInConnectionService s = pluginService.get(pluginType);
-            s.notifyNodeDisconnectFromMaster(node);
+        IPluginInConnectionService s = pluginService.get(node.getType());
+        if (s != null) {
+             s.notifyNodeDisconnectFromMaster(node);
         }
     }
-}
\ No newline at end of file
+}