Address TODOs: use NetconfRpcFutureCallback for RPC callback
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / sal / tx / WriteCandidateRunningTx.java
index a693e8c59c3db5a07fc0538a675e72f550582b86..2729444311417022e777eacb78fe639d046b2b5f 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.netconf.sal.connect.netconf.sal.tx;
 
-import com.google.common.util.concurrent.FutureCallback;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfRpcFutureCallback;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
@@ -44,25 +42,7 @@ public class WriteCandidateRunningTx extends WriteCandidateTx {
     }
 
     private void lockRunning() {
-        final FutureCallback<DOMRpcResult> lockRunningCallback = new FutureCallback<DOMRpcResult>() {
-            @Override
-            public void onSuccess(DOMRpcResult result) {
-                if (isSuccess(result)) {
-                    if (LOG.isTraceEnabled()) {
-                        LOG.trace("Lock running succesfull");
-                    }
-                } else {
-                    LOG.warn("{}: lock running invoked unsuccessfully: {}", id, result.getErrors());
-                }
-            }
-
-            @Override
-            public void onFailure(Throwable t) {
-                LOG.warn("{}: Failed to lock running. Failed to initialize transaction", id, t);
-                throw new RuntimeException(id + ": Failed to lock running. Failed to initialize transaction", t);
-            }
-        };
-        netOps.lockRunning(lockRunningCallback);
+        resultsFutures.add(netOps.lockRunning(new NetconfRpcFutureCallback("Lock running", id)));
     }
 
     /**