Fix some SpotBugs issues
[transportpce.git] / common / src / main / java / org / opendaylight / transportpce / common / openroadminterfaces / OpenRoadmInterfacesImpl221.java
index 1148f179997a79df4196c57c2d51acf417e24c95..3c8c95a1ab09429de9d2a80afc8ec82d8f106b7a 100755 (executable)
@@ -8,11 +8,13 @@
 
 package org.opendaylight.transportpce.common.openroadminterfaces;
 
-import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.mdsal.common.api.CommitInfo;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.StringConstants;
 import org.opendaylight.transportpce.common.Timeouts;
 import org.opendaylight.transportpce.common.device.DeviceTransaction;
@@ -69,8 +71,8 @@ public class OpenRoadmInterfacesImpl221 {
         LOG.info("POST INTERF for {} : InterfaceBuilder : name = {} \t type = {}", nodeId, ifBuilder.getName(),
             ifBuilder.getType().toString());
         deviceTx.put(LogicalDatastoreType.CONFIGURATION, interfacesIID, ifBuilder.build());
-        ListenableFuture<Void> txSubmitFuture = deviceTx.submit(Timeouts.DEVICE_WRITE_TIMEOUT,
-            Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
+        FluentFuture<? extends @NonNull CommitInfo> txSubmitFuture =
+            deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
         try {
             txSubmitFuture.get();
             LOG.info("Successfully posted interface {} on node {}", ifBuilder.getName(), nodeId);
@@ -158,11 +160,11 @@ public class OpenRoadmInterfacesImpl221 {
             }
 
             deviceTx.delete(LogicalDatastoreType.CONFIGURATION, interfacesIID);
-            ListenableFuture<Void> submit = deviceTx.submit(Timeouts.DEVICE_WRITE_TIMEOUT,
-                Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
+            FluentFuture<? extends @NonNull CommitInfo> commit =
+                deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
 
             try {
-                submit.get();
+                commit.get();
                 LOG.info("Successfully deleted {} on node {}", interfaceName, nodeId);
             } catch (InterruptedException | ExecutionException e) {
                 throw new OpenRoadmInterfaceException(String.format("Failed to delete interface %s on " + "node %s",
@@ -196,13 +198,13 @@ public class OpenRoadmInterfacesImpl221 {
         CircuitPacksBuilder cpBldr = new CircuitPacksBuilder(cp);
         boolean change = false;
         if (activate) {
-            if (cpBldr.getEquipmentState() != null && !cpBldr.getEquipmentState().getName()
-                .equals(States.NotReservedInuse)) {
+            if (cpBldr.getEquipmentState() != null
+                    && !cpBldr.getEquipmentState().getName().equals(States.NotReservedInuse)) {
                 cpBldr.setEquipmentState(States.NotReservedInuse);
                 change = true;
             }
-        } else if ((cpBldr.getEquipmentState() != null && !cpBldr.getEquipmentState().getName()
-            .equals(States.NotReservedAvailable))) {
+        } else if ((cpBldr.getEquipmentState() != null
+                && !cpBldr.getEquipmentState().getName().equals(States.NotReservedAvailable))) {
             cpBldr.setEquipmentState(States.NotReservedAvailable);
             change = true;
         }
@@ -223,8 +225,8 @@ public class OpenRoadmInterfacesImpl221 {
                     nodeId), e);
             }
             deviceTx.put(LogicalDatastoreType.CONFIGURATION, circuitPackIID, cpBldr.build());
-            ListenableFuture<Void> txSubmitFuture = deviceTx.submit(Timeouts.DEVICE_WRITE_TIMEOUT,
-                Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
+            FluentFuture<? extends @NonNull CommitInfo> txSubmitFuture =
+                deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
             try {
                 txSubmitFuture.get();
                 LOG.info("Successfully posted equipment state change on node {}", nodeId);