MD-SAL Statistics Manager - Did temporary fix for avoiding CSIT test failure.
[controller.git] / opendaylight / md-sal / statistics-manager / src / main / java / org / opendaylight / controller / md / statistics / manager / StatisticsProvider.java
index 5218d051fa2cdb40ec9fa47f58114abf5c334dc6..d1ab3515035dfb0b5597c263c5f23ac29656d659 100644 (file)
@@ -100,8 +100,6 @@ public class StatisticsProvider implements AutoCloseable {
             public void run() {
                 while(true){
                     try {
-                        spLogger.info("Statistics requester thread started with timer interval : {}",5000);
-                        
                         statsRequestSender();
                         
                         Thread.sleep(5000);
@@ -111,6 +109,11 @@ public class StatisticsProvider implements AutoCloseable {
                 }
             }
         });
+        
+        spLogger.debug("Statistics requester thread started with timer interval : {}",5000);
+        
+        statisticsRequesterThread.start();
+        
         spLogger.info("Statistics Provider started.");
     }
     
@@ -124,6 +127,9 @@ public class StatisticsProvider implements AutoCloseable {
         
         //Need to call API to receive all the nodes connected to controller.
         List<Node> targetNodes = getAllConnectedNodes();
+        
+        if(targetNodes == null)
+            return;
 
         for (Node targetNode : targetNodes){
             spLogger.info("Send request for stats collection to node : {})",targetNode.getId());
@@ -212,6 +218,9 @@ public class StatisticsProvider implements AutoCloseable {
     private List<Node> getAllConnectedNodes(){
         
         Nodes nodes = (Nodes) dps.readOperationalData(nodesIdentifier);
+        if(nodes == null)
+            return null;
+        
         spLogger.info("Number of connected nodes : {}",nodes.getNode().size());
         return nodes.getNode();
     }