Merge "Use generic-aware empty collections"
[controller.git] / opendaylight / sal / connection / implementation / src / main / java / org / opendaylight / controller / sal / connection / implementation / internal / ConnectionService.java
index 1c7e2c05e65f54d28a6560b7c62daa5054104046..5a637b79991fa26553e0b902571c2ecd311b7b40 100644 (file)
@@ -8,13 +8,9 @@
 
 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;
-
 import org.opendaylight.controller.sal.connection.ConnectionConstants;
 import org.opendaylight.controller.sal.connection.ConnectionLocality;
 import org.opendaylight.controller.sal.connection.IConnectionListener;
@@ -35,7 +31,7 @@ public class ConnectionService implements IPluginOutConnectionService, IConnecti
     private ConcurrentMap<String, IPluginInConnectionService> pluginService =
             new ConcurrentHashMap<String, IPluginInConnectionService>();
 
-    void setPluginService (Map props, IPluginInConnectionService s) {
+    void setPluginService (Map<?, ?> props, IPluginInConnectionService s) {
         String type = null;
         Object value = props.get(GlobalConstants.PROTOCOLPLUGINTYPE.toString());
         if (value instanceof String) {
@@ -49,7 +45,7 @@ public class ConnectionService implements IPluginOutConnectionService, IConnecti
         }
     }
 
-    void unsetPluginService(Map props, IPluginInConnectionService s) {
+    void unsetPluginService(Map<?, ?> props, IPluginInConnectionService s) {
         String type = null;
 
         Object value = props.get(GlobalConstants.PROTOCOLPLUGINTYPE.toString());
@@ -114,7 +110,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 +122,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 +153,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
+}