syncDelete replaced with non sync delete 00/73800/3
authorShashidhar Raja <shashidharr@altencalsoftlabs.com>
Thu, 5 Jul 2018 14:22:24 +0000 (19:52 +0530)
committerSam Hague <shague@redhat.com>
Sat, 7 Jul 2018 04:24:32 +0000 (04:24 +0000)
An attempt is made to remove syncDelete as sync operation is not needed
during DS remove operation in this case

Change-Id: I892f003749031cf0f7cea00542a5ee95802ba17a
Signed-off-by: Shashidhar Raja <shashidharr@altencalsoftlabs.com>
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/utils/AclServiceUtils.java

index 9fd87f19ee38cb3ff644cae074e760d80d608776..0f6bba0614dd8237d0fc8d24a0c0a76885c30ead 100644 (file)
@@ -40,8 +40,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
 import org.opendaylight.genius.infra.Datastore.Operational;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
@@ -74,6 +72,7 @@ import org.opendaylight.genius.mdsalutil.matches.MatchUdpSourcePort;
 import org.opendaylight.genius.mdsalutil.nxmatches.NxMatchRegister;
 import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
 import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
+import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.MatchCriteria;
 import org.opendaylight.netvirt.aclservice.api.utils.AclInterface;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.AccessLists;
@@ -877,11 +876,8 @@ public final class AclServiceUtils {
     public void deleteSubnetInfo(String portId) {
         InstanceIdentifier<PortSubnet> id = InstanceIdentifier.builder(PortSubnets.class)
                 .child(PortSubnet.class, new PortSubnetKey(portId)).build();
-        try {
-            SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.OPERATIONAL, id);
-        } catch (TransactionCommitFailedException e) {
-            LOG.error("Failed to delete subnet info for port={}", portId, e);
-        }
+        ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+                OPERATIONAL, tx -> tx.delete(id)), LOG, "Failed to delete subnet info for port: " + portId);
     }
 
     private static List<MatchInfoBase> updateAAPMatches(boolean isSourceIpMacMatch, List<MatchInfoBase> flows,
@@ -1249,11 +1245,6 @@ public final class AclServiceUtils {
         return skipDelete;
     }
 
-    public static void deleteAclPortsLookupEntry(String aclName, DataBroker broker)
-            throws TransactionCommitFailedException {
-        SingleTransactionDataBroker.syncDelete(broker, LogicalDatastoreType.OPERATIONAL, aclPortsByIpPath(aclName));
-    }
-
     public static InstanceIdentifier<AclPortsByIp> aclPortsByIpPath(String aclName) {
         return InstanceIdentifier.builder(AclPortsLookup.class)
                 .child(AclPortsByIp.class, new AclPortsByIpKey(aclName)).build();