Merge "OPNFLWPLUG-963 : Updating ports delete reason from OFP:"
[openflowplugin.git] / applications / bulk-o-matic / src / main / java / org / opendaylight / openflowplugin / applications / bulk / o / matic / FlowWriterSequential.java
index 2fc3a2802b636db6f783347a77b3ab93e53e7593..7e8fe0009fab658b03f81e8f2ae3379d13100036 100644 (file)
@@ -9,6 +9,8 @@ package org.opendaylight.openflowplugin.applications.bulk.o.matic;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
+
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
@@ -37,24 +39,24 @@ public class FlowWriterSequential implements FlowCounterMBean {
         LOG.info("Using Sequential implementation of Flow Writer.");
     }
 
-    public void addFlows(Integer dpnCount, Integer flowsPerDPN, int batchSize, int sleepMillis, short startTableId,
+    public void addFlows(Integer count, Integer flowsPerDPN, int batchSize, int sleepMillis, short startTableId,
             short endTableId, boolean isCreateParents) {
         LOG.info("Using Sequential implementation of Flow Writer.");
-        this.dpnCount = dpnCount;
-        countDpnWriteCompletion.set(dpnCount);
+        this.dpnCount = count;
+        countDpnWriteCompletion.set(count);
         startTime = System.nanoTime();
-        for (int i = 1; i <= dpnCount; i++) {
+        for (int i = 1; i <= count; i++) {
             FlowHandlerTask task = new FlowHandlerTask(Integer.toString(i), flowsPerDPN, true, batchSize, sleepMillis,
                     startTableId, endTableId, isCreateParents);
             flowPusher.execute(task);
         }
     }
 
-    public void deleteFlows(Integer dpnCount, Integer flowsPerDPN, int batchSize, short startTableId,
+    public void deleteFlows(Integer count, Integer flowsPerDPN, int batchSize, short startTableId,
             short endTableId) {
         LOG.info("Using Sequential implementation of Flow Writer.");
-        countDpnWriteCompletion.set(dpnCount);
-        for (int i = 1; i <= dpnCount; i++) {
+        countDpnWriteCompletion.set(count);
+        for (int i = 1; i <= count; i++) {
             FlowHandlerTask task = new FlowHandlerTask(Integer.toString(i), flowsPerDPN, false, batchSize, 0,
                     startTableId, endTableId, false);
             flowPusher.execute(task);
@@ -132,7 +134,8 @@ public class FlowWriterSequential implements FlowCounterMBean {
             LOG.debug("Submitting Txn for dpId: {}, begin tableId: {}, end tableId: {}, sourceIp: {}", dpId, tableId,
                     calculatedTableId, sourceIp);
 
-            Futures.addCallback(writeTransaction.submit(), new DsCallBack(dpId, sourceIp, calculatedTableId));
+            Futures.addCallback(writeTransaction.submit(), new DsCallBack(dpId, sourceIp, calculatedTableId),
+                    MoreExecutors.directExecutor());
         }
 
         private void addFlowToTx(WriteTransaction writeTransaction, String flowId, InstanceIdentifier<Flow> flowIid,
@@ -203,7 +206,8 @@ public class FlowWriterSequential implements FlowCounterMBean {
                 }
                 LOG.debug("OnSuccess: Submitting Txn for dpId: {}, begin tableId: {}, end tableId: {}, sourceIp: {}",
                         dpId, tableId, calculatedTableId, sourceIp);
-                Futures.addCallback(writeTransaction.submit(), new DsCallBack(dpId, sourceIp, calculatedTableId));
+                Futures.addCallback(writeTransaction.submit(), new DsCallBack(dpId, sourceIp, calculatedTableId),
+                        MoreExecutors.directExecutor());
             }
 
             @Override