OPNFLWPLUG-983 Group and flow removal stats are not reported in order
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / StatisticsContextImpl.java
index 89beb9527baca1703fae7b4e19143008c9a82b00..724531b94f87c2a0028065a3e045e7337e376140 100644 (file)
@@ -155,10 +155,6 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
             statListForCollecting.add(MultipartType.OFPMPTABLE);
         }
 
-        if (devState.isFlowStatisticsAvailable()) {
-            statListForCollecting.add(MultipartType.OFPMPFLOW);
-        }
-
         if (devState.isGroupAvailable()) {
             statListForCollecting.add(MultipartType.OFPMPGROUPDESC);
             statListForCollecting.add(MultipartType.OFPMPGROUP);
@@ -169,6 +165,10 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
             statListForCollecting.add(MultipartType.OFPMPMETER);
         }
 
+        if (devState.isFlowStatisticsAvailable()) {
+            statListForCollecting.add(MultipartType.OFPMPFLOW);
+        }
+
         if (devState.isPortStatisticsAvailable()) {
             statListForCollecting.add(MultipartType.OFPMPPORTSTATS);
         }
@@ -221,7 +221,8 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
             // build statistics gathering future
             final ListenableFuture<Boolean> newDataGathering = collectingStatType.stream()
                     .reduce(lastDataGathering, this::statChainFuture,
-                        (listenableFuture, asyn) -> Futures.transformAsync(listenableFuture, result -> asyn));
+                        (listenableFuture, asyn) -> Futures.transformAsync(listenableFuture, result -> asyn,
+                                MoreExecutors.directExecutor()));
 
             // write end timestamp to state snapshot container
             Futures.addCallback(newDataGathering, new FutureCallback<Boolean>() {
@@ -266,7 +267,7 @@ class StatisticsContextImpl<T extends OfHeader> implements StatisticsContext {
                                       getDeviceInfo(), multipartType, deviceContext, deviceContext, convertorExecutor,
                                       statisticsWriterProvider, executorService) : Futures
                     .immediateFuture(Boolean.FALSE);
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private void startGatheringData() {