2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.netconf.sal.connect.netconf.sal.tx;
11 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
12 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfRpcFutureCallback;
13 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
18 * Tx implementation for netconf devices that support only candidate datastore and writable running
19 * The sequence goes exactly as with only candidate supported, with one addition:
21 * <li>Running datastore is locked as the first thing and this lock has to succeed</li>
24 public class WriteCandidateRunningTx extends WriteCandidateTx {
26 private static final Logger LOG = LoggerFactory.getLogger(WriteCandidateRunningTx.class);
28 public WriteCandidateRunningTx(final RemoteDeviceId id, final NetconfBaseOps netOps, final boolean rollbackSupport) {
29 super(id, netOps, rollbackSupport);
33 protected synchronized void init() {
39 protected void cleanupOnSuccess() {
40 super.cleanupOnSuccess();
44 private void lockRunning() {
45 resultsFutures.add(netOps.lockRunning(new NetconfRpcFutureCallback("Lock running", id)));
49 * 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
51 private void unlockRunning() {
52 netOps.unlockRunning(new NetconfRpcFutureCallback("Unlock running", id));