Fix direct statistics 14/47414/1
authormiroslav.macko <miroslav.macko@pantheon.tech>
Mon, 24 Oct 2016 09:14:37 +0000 (11:14 +0200)
committermiroslav.macko <miroslav.macko@pantheon.tech>
Mon, 24 Oct 2016 09:23:10 +0000 (11:23 +0200)
- Initialize statistics gathering

Resolves: bug 7007

Change-Id: I0970b3c690f0771dbd1637405e3064a984b1ef4c
Signed-off-by: miroslav.macko <miroslav.macko@pantheon.tech>
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java

index 92d03ecf187d8d63e953e9611bac69da2c114e81..a8ded174eb7a0207c4344244361a082f1aabac59 100644 (file)
@@ -476,27 +476,25 @@ class StatisticsContextImpl implements StatisticsContext {
             return false;
         }
 
-        if (!this.shuttingDownStatisticsPolling) {
-
-            LOG.info("Starting statistics context cluster services for node {}", deviceInfo.getLOGValue());
-
-            this.statListForCollectingInitialization();
-            Futures.addCallback(this.initialGatherDynamicData(), new FutureCallback<Boolean>() {
+        LOG.info("Starting statistics context cluster services for node {}", deviceInfo.getLOGValue());
 
-                        @Override
-                        public void onSuccess(@Nullable Boolean aBoolean) {
-                            initialSubmitHandler.initialSubmitTransaction();
-                        }
+        this.statListForCollectingInitialization();
+        Futures.addCallback(this.initialGatherDynamicData(), new FutureCallback<Boolean>() {
 
-                        @Override
-                        public void onFailure(Throwable throwable) {
-                            LOG.warn("Initial gathering statistics unsuccessful for node {}", deviceInfo.getLOGValue());
-                            lifecycleService.closeConnection();
-                        }
-                    });
+            @Override
+            public void onSuccess(@Nullable Boolean aBoolean) {
+                initialSubmitHandler.initialSubmitTransaction();
+            }
 
-                    myManager.startScheduling(deviceInfo);
+            @Override
+            public void onFailure(Throwable throwable) {
+                LOG.warn("Initial gathering statistics unsuccessful for node {}", deviceInfo.getLOGValue());
+                lifecycleService.closeConnection();
+            }
+        });
 
+        if (!this.shuttingDownStatisticsPolling) {
+            myManager.startScheduling(deviceInfo);
         }
 
         return this.clusterInitializationPhaseHandler.onContextInstantiateService(connectionContext);