Merge "When a node is going down, remove edges in both directions associated with...
[controller.git] / opendaylight / protocol_plugins / openflow / src / main / java / org / opendaylight / controller / protocol_plugin / openflow / internal / ReadServiceFilter.java
index dbcd5c8f37d23b3f46abdbb5b4adad3e9392a15b..7f9a13e92ac3be846342a7615e37ec658d8b9fa0 100644 (file)
@@ -10,6 +10,7 @@
 package org.opendaylight.controller.protocol_plugin.openflow.internal;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -17,7 +18,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentSkipListSet;
 
 import org.opendaylight.controller.protocol_plugin.openflow.IOFStatisticsListener;
 import org.opendaylight.controller.protocol_plugin.openflow.IOFStatisticsManager;
@@ -437,7 +437,8 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
         switch (type) {
         case ADDED:
             if (!containerToNc.containsKey(containerName)) {
-                containerToNc.put(containerName, new ConcurrentSkipListSet<NodeConnector>());
+                containerToNc.put(containerName,
+                    Collections.newSetFromMap(new ConcurrentHashMap<NodeConnector,Boolean>()));
             }
             containerToNc.get(containerName).add(p);
             if (!containerToNode.containsKey(containerName)) {
@@ -467,7 +468,6 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
                         nodeSet.remove(node);
                     }
                 }
-
             }
             break;
         case CHANGED:
@@ -587,9 +587,7 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
             flowOnNodeList = filterFlowListPerContainer(container, node, flowOnNodeList);
 
             // notify listeners
-            if (!flowOnNodeList.isEmpty()) {
-                l.getValue().nodeFlowStatisticsUpdated(node, flowOnNodeList);
-            }
+            l.getValue().nodeFlowStatisticsUpdated(node, flowOnNodeList);
         }
     }
 
@@ -606,9 +604,8 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
                     .getNodeConnectorStatsList();
 
             // notify listeners
-            if (!ncStatsList.isEmpty()) {
-                l.getValue().nodeConnectorStatisticsUpdated(node, ncStatsList);
-            }
+            l.getValue().nodeConnectorStatisticsUpdated(node, ncStatsList);
+
         }
     }
 
@@ -625,9 +622,7 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
                     .getNodeTableStatsList();
 
             // notify listeners
-            if (!tableStatsList.isEmpty()) {
-                l.getValue().nodeTableStatisticsUpdated(node, tableStatsList);
-            }
+            l.getValue().nodeTableStatisticsUpdated(node, tableStatsList);
         }
     }
 }