aclservice: clean up Futures collections 75/63375/2
authorStephen Kitt <skitt@redhat.com>
Mon, 11 Sep 2017 13:28:30 +0000 (15:28 +0200)
committerSam Hague <shague@redhat.com>
Wed, 20 Sep 2017 23:51:34 +0000 (23:51 +0000)
This patch replaces lists of Futures with singleton lists where
possible.

Change-Id: I5d3445c488599f28b920a2296e0d2ab439761a43
Signed-off-by: Stephen Kitt <skitt@redhat.com>
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractEgressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractIngressAclServiceImpl.java

index 189e19c98f449636a7611481252638b0b570a7b4..1470e1b1e53e673d494bcc49c419e920b7ca2e5e 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.netvirt.aclservice;
 
-import com.google.common.util.concurrent.ListenableFuture;
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -385,21 +385,19 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
             List<InstructionInfo> instructions, int addOrRemove) {
         DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
         dataStoreCoordinator.enqueueJob(flowName, () -> {
-            List<ListenableFuture<Void>> futures = new ArrayList<>();
             if (addOrRemove == NwConstants.DEL_FLOW) {
                 FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, flowId, priority, flowName,
                         idleTimeOut, hardTimeOut, cookie, matches, null);
                 LOG.trace("Removing Acl Flow DpnId {}, flowId {}", dpId, flowId);
 
-                futures.add(mdsalManager.removeFlow(dpId, flowEntity));
+                return Collections.singletonList(mdsalManager.removeFlow(dpId, flowEntity));
 
             } else {
                 FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, flowId, priority, flowName,
                         idleTimeOut, hardTimeOut, cookie, matches, instructions);
                 LOG.trace("Installing DpnId {}, flowId {}", dpId, flowId);
-                futures.add(mdsalManager.installFlow(dpId, flowEntity));
+                return Collections.singletonList(mdsalManager.installFlow(dpId, flowEntity));
             }
-            return futures;
         });
     }
 
index fe075b0cb4734b7757d0c6d01385a50773404fa2..6a8c3a78e4bd445d45af0419175e9b9ced04e245 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netvirt.aclservice;
 
-import com.google.common.util.concurrent.ListenableFuture;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -150,9 +149,7 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
                 WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
                 writeTxn.delete(LogicalDatastoreType.CONFIGURATION, path);
 
-                List<ListenableFuture<Void>> futures = new ArrayList<>();
-                futures.add(writeTxn.submit());
-                return futures;
+                return Collections.singletonList(writeTxn.submit());
             });
     }
 
index 2960991da63832c0b51c706bba9cebfbc8da5876..b0f39941d97ac7f6769ad5f0ca5ecd1d1db79cf5 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netvirt.aclservice;
 
-import com.google.common.util.concurrent.ListenableFuture;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -145,9 +144,7 @@ public abstract class AbstractIngressAclServiceImpl extends AbstractAclServiceIm
                 WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
                 writeTxn.delete(LogicalDatastoreType.CONFIGURATION, path);
 
-                List<ListenableFuture<Void>> futures = new ArrayList<>();
-                futures.add(writeTxn.submit());
-                return futures;
+                return Collections.singletonList(writeTxn.submit());
             });
     }