bug 741 - Make sure to stop threads on bundle stop on TopologyServiceShim 02/6202/1
authorGiovanni Meo <gmeo@cisco.com>
Tue, 15 Apr 2014 12:45:18 +0000 (14:45 +0200)
committerGiovanni Meo <gmeo@cisco.com>
Tue, 15 Apr 2014 12:45:18 +0000 (14:45 +0200)
- Cleanup of threads on bundle stop as well adjust of the logging
level during InterruptException

Change-Id: I3ae7aa5f50f76fae72c3119d00459f11ffa5a4ee
Signed-off-by: Giovanni Meo <gmeo@cisco.com>
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java

index fc668b3..1a59a32 100644 (file)
@@ -148,7 +148,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa
                         Thread.sleep(10);
                     }
                 } catch (InterruptedException e1) {
-                    logger.warn("DiscoveryTransmit interupted", e1.getMessage());
+                    logger.trace("DiscoveryTransmit interupted", e1.getMessage());
                     if (shuttingDown) {
                         return;
                     }
index dacc130..08ddbde 100644 (file)
@@ -141,7 +141,7 @@ public class TopologyServiceShim implements IDiscoveryListener,
 
                     Thread.sleep(100);
                 } catch (InterruptedException e1) {
-                    logger.warn("TopologyNotify interrupted {}",
+                    logger.trace("TopologyNotify interrupted {}",
                             e1.getMessage());
                     if (shuttingDown) {
                         return;
@@ -200,7 +200,7 @@ public class TopologyServiceShim implements IDiscoveryListener,
                         }
                     }
                 } catch (InterruptedException e1) {
-                    logger.warn(
+                    logger.trace(
                             "Edge Bandwidth Utilization Notify Thread interrupted {}",
                             e1.getMessage());
                     if (shuttingDown) {
@@ -235,10 +235,9 @@ public class TopologyServiceShim implements IDiscoveryListener,
                         logger.debug("Bulk Notify container:{}", containerName);
                         TopologyBulkUpdate(containerName);
                     } catch (InterruptedException e) {
-                        logger.warn("Topology Bulk update thread interrupted");
+                        logger.trace("Topology Bulk update thread interrupted");
                         if (shuttingDown) {
-                            return;
-                        }
+                            return;                        }
                     }
                 }
             }
@@ -265,6 +264,10 @@ public class TopologyServiceShim implements IDiscoveryListener,
     protected void pollTxBitRates() {
         Map<NodeConnector, Pair<Edge, Set<Property>>> globalContainerEdges = edgeMap
                 .get(GlobalConstants.DEFAULT.toString());
+        if (shuttingDown) {
+            logger.trace("Getting out the pollTxBitRates because bundle going down");
+            return;
+        }
         if (globalContainerEdges == null) {
             return;
         }
@@ -357,6 +360,9 @@ public class TopologyServiceShim implements IDiscoveryListener,
         logger.trace("STOP called!");
         shuttingDown = true;
         notifyThread.interrupt();
+        bwUtilNotifyThread.interrupt();
+        ofPluginTopoBulkUpdate.interrupt();
+        pollTimer.cancel();
     }
 
     void setTopologyServiceShimListener(Map<?, ?> props,

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.