X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fsal-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fsal%2Fconnect%2Fnetconf%2Fsal%2Ftx%2FWriteCandidateRunningTx.java;h=fefddc5720b269fd92e2cacb56257fb8ec848e94;hb=a0833fb27c69d919a4420c6ecbd11a3b2a1119cb;hp=2729444311417022e777eacb78fe639d046b2b5f;hpb=b63c5edc0f896e131846e975340cef7e9f1e0f36;p=netconf.git
diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTx.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTx.java
index 2729444311..fefddc5720 100644
--- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTx.java
+++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTx.java
@@ -15,7 +15,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Tx implementation for netconf devices that support only candidate datastore and writable running
+ * Tx implementation for netconf devices that support only candidate datastore and writable running.
* The sequence goes exactly as with only candidate supported, with one addition:
*
* - Running datastore is locked as the first thing and this lock has to succeed
@@ -25,8 +25,14 @@ public class WriteCandidateRunningTx extends WriteCandidateTx {
private static final Logger LOG = LoggerFactory.getLogger(WriteCandidateRunningTx.class);
- public WriteCandidateRunningTx(final RemoteDeviceId id, final NetconfBaseOps netOps, final boolean rollbackSupport) {
- super(id, netOps, rollbackSupport);
+ public WriteCandidateRunningTx(final RemoteDeviceId id, final NetconfBaseOps netOps,
+ final boolean rollbackSupport) {
+ this(id, netOps, rollbackSupport, true);
+ }
+
+ public WriteCandidateRunningTx(RemoteDeviceId id, NetconfBaseOps netconfOps, boolean rollbackSupport,
+ boolean isLockAllowed) {
+ super(id, netconfOps, rollbackSupport, isLockAllowed);
}
@Override
@@ -42,13 +48,22 @@ public class WriteCandidateRunningTx extends WriteCandidateTx {
}
private void lockRunning() {
- resultsFutures.add(netOps.lockRunning(new NetconfRpcFutureCallback("Lock running", id)));
+ if (isLockAllowed) {
+ resultsFutures.add(netOps.lockRunning(new NetconfRpcFutureCallback("Lock running", id)));
+ } else {
+ LOG.trace("Lock is not allowed: {}", id);
+ }
}
/**
- * This has to be non blocking since it is called from a callback on commit and its netty threadpool that is really sensitive to blocking calls
+ * This has to be non blocking since it is called from a callback on commit
+ * and its netty threadpool that is really sensitive to blocking calls.
*/
private void unlockRunning() {
- netOps.unlockRunning(new NetconfRpcFutureCallback("Unlock running", id));
+ if (isLockAllowed) {
+ netOps.unlockRunning(new NetconfRpcFutureCallback("Unlock running", id));
+ } else {
+ LOG.trace("Unlock is not allowed: {}", id);
+ }
}
}