@Override
ReadOnlyTransaction newReadOnlyTransaction();
- /**
- * {@inheritDoc}
- */
- @Override
- ReadWriteTransaction newReadWriteTransaction();
-
/**
* {@inheritDoc}
*/
@Override
ReadOnlyTransaction newReadOnlyTransaction();
- /**
- * {@inheritDoc}
- */
- @Override
- ReadWriteTransaction newReadWriteTransaction();
-
/**
* {@inheritDoc}
*/
package org.opendaylight.mdsal.binding.api;
import org.opendaylight.mdsal.common.api.AsyncReadOnlyTransaction;
-
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.ReadFailedException;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+
/**
* A transaction that provides a stateful read-only view of the data tree.
* <p>
* For more information on usage and examples, please see the documentation in
* {@link org.opendaylight.mdsal.common.api.AsyncReadTransaction}.
*/
-public interface ReadOnlyTransaction extends ReadTransaction, AsyncReadOnlyTransaction<InstanceIdentifier<?>, DataObject> {
+public interface ReadOnlyTransaction extends AsyncReadOnlyTransaction<InstanceIdentifier<?>, DataObject> {
+ /**
+ * Reads data from the provided logical data store located at the provided path.
+ *<p>
+ * If the target is a subtree, then the whole subtree is read (and will be
+ * accessible from the returned data object).
+ *
+ * @param store
+ * Logical data store from which read should occur.
+ * @param path
+ * Path which uniquely identifies subtree which client want to
+ * read
+ * @return a CheckFuture containing the result of the read. The Future blocks until the
+ * commit operation is complete. Once complete:
+ * <ul>
+ * <li>If the data at the supplied path exists, the Future returns an Optional object
+ * containing the data.</li>
+ * <li>If the data at the supplied path does not exist, the Future returns
+ * Optional#absent().</li>
+ * <li>If the read of the data fails, the Future will fail with a
+ * {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
+ * </ul>
+ */
+ <T extends DataObject> CheckedFuture<Optional<T>,ReadFailedException> read(
+ LogicalDatastoreType store, InstanceIdentifier<T> path);
}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.binding.api;
-
-import org.opendaylight.mdsal.common.api.AsyncReadTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.ReadFailedException;
-
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-
-/**
- * A transaction that provides read access to a logical data store.
- * <p>
- * For more information on usage and examples, please see the documentation in {@link AsyncReadTransaction}.
- */
-public interface ReadTransaction extends AsyncReadTransaction<InstanceIdentifier<?>, DataObject> {
-
- /**
- * Reads data from the provided logical data store located at the provided path.
- *<p>
- * If the target is a subtree, then the whole subtree is read (and will be
- * accessible from the returned data object).
- *
- * @param store
- * Logical data store from which read should occur.
- * @param path
- * Path which uniquely identifies subtree which client want to
- * read
- * @return a CheckFuture containing the result of the read. The Future blocks until the
- * commit operation is complete. Once complete:
- * <ul>
- * <li>If the data at the supplied path exists, the Future returns an Optional object
- * containing the data.</li>
- * <li>If the data at the supplied path does not exist, the Future returns
- * Optional#absent().</li>
- * <li>If the read of the data fails, the Future will fail with a
- * {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
- * </ul>
- */
- <T extends DataObject> CheckedFuture<Optional<T>,ReadFailedException> read(
- LogicalDatastoreType store, InstanceIdentifier<T> path);
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.binding.api;
-
-import org.opendaylight.mdsal.common.api.AsyncReadWriteTransaction;
-
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * A transaction that enables combined read/write capabilities.
- * <p>
- * For more information on usage and examples, please see the documentation in {@link AsyncReadWriteTransaction}.
- */
-public interface ReadWriteTransaction extends ReadTransaction, WriteTransaction, AsyncReadWriteTransaction<InstanceIdentifier<?>, DataObject> {
-
-}
@Override
ReadOnlyTransaction newReadOnlyTransaction();
- @Override
- ReadWriteTransaction newReadWriteTransaction();
-
@Override
WriteTransaction newWriteOnlyTransaction();
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.binding.dom.adapter;
-
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AbstractReadWriteTransaction extends AbstractWriteTransaction<DOMDataReadWriteTransaction> {
-
- private static final Logger LOG = LoggerFactory.getLogger(AbstractReadWriteTransaction.class);
-
- public AbstractReadWriteTransaction(final DOMDataReadWriteTransaction delegate, final BindingToNormalizedNodeCodec codec) {
- super(delegate, codec);
- }
-
-}
import org.opendaylight.mdsal.binding.api.DataTreeChangeService;
import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
import org.opendaylight.mdsal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMAdapterBuilder.Factory;
import com.google.common.collect.ClassToInstanceMap;
}
@Override
-
public ReadOnlyTransaction newReadOnlyTransaction() {
return new BindingDOMReadTransactionAdapter(getDelegate().newReadOnlyTransaction(),getCodec());
}
- @Override
- public ReadWriteTransaction newReadWriteTransaction() {
- return new BindingDOMReadWriteTransactionAdapter(getDelegate().newReadWriteTransaction(),getCodec());
- }
-
@Override
public WriteTransaction newWriteOnlyTransaction() {
return new BindingDOMWriteTransactionAdapter<>(getDelegate().newWriteOnlyTransaction(),getCodec());
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.binding.dom.adapter;
-
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.ReadFailedException;
-
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
-import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-
-class BindingDOMReadWriteTransactionAdapter extends
- BindingDOMWriteTransactionAdapter<DOMDataReadWriteTransaction> implements ReadWriteTransaction {
-
- protected BindingDOMReadWriteTransactionAdapter(final DOMDataReadWriteTransaction delegate,
- final BindingToNormalizedNodeCodec codec) {
- super(delegate, codec);
- }
-
- @Override
- public <T extends DataObject> CheckedFuture<Optional<T>,ReadFailedException> read(
- final LogicalDatastoreType store, final InstanceIdentifier<T> path) {
- return doRead(getDelegate(), store, path);
- }
-}
\ No newline at end of file
import org.opendaylight.mdsal.dom.api.DOMDataBroker;
import org.opendaylight.mdsal.dom.api.DOMDataReadOnlyTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
import org.opendaylight.mdsal.binding.api.BindingTransactionChain;
import org.opendaylight.mdsal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.CheckedFuture;
return new BindingDOMReadTransactionAdapter(delegateTx, codec);
}
- @Override
- public ReadWriteTransaction newReadWriteTransaction() {
- final DOMDataReadWriteTransaction delegateTx = delegate.newReadWriteTransaction();
- return new BindingDOMReadWriteTransactionAdapter(delegateTx, codec) {
-
- @Override
- public CheckedFuture<Void, TransactionCommitFailedException> submit() {
- return listenForFailure(this,super.submit());
- }
-
- };
- }
-
@Override
public WriteTransaction newWriteOnlyTransaction() {
final DOMDataWriteTransaction delegateTx = delegate.newWriteOnlyTransaction();
import static org.opendaylight.mdsal.binding.test.model.util.ListsBindingUtils.top;
import static org.opendaylight.mdsal.binding.test.model.util.ListsBindingUtils.topLevelList;
import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
+
import org.opendaylight.mdsal.common.api.AsyncDataChangeEvent;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.common.api.AsyncDataBroker.DataChangeScope;
-import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeComplexUsesAugment;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top;
TreeComplexUsesAugment.class);
public void writeTopWithListItem(final LogicalDatastoreType store) {
- final ReadWriteTransaction tx = getDataBroker().newReadWriteTransaction();
+ final WriteTransaction tx = getDataBroker().newWriteOnlyTransaction();
final Top topItem = top(topLevelList(TOP_FOO_KEY, complexUsesAugment(USES_ONE_KEY, USES_TWO_KEY)));
tx.put(store, TOP_PATH, topItem);
assertCommit(tx.submit());
}
public void deleteItem(final LogicalDatastoreType store, final InstanceIdentifier<?> path) {
- final ReadWriteTransaction tx = getDataBroker().newReadWriteTransaction();
+ final WriteTransaction tx = getDataBroker().newWriteOnlyTransaction();
tx.delete(store, path);
assertCommit(tx.submit());
}
import org.opendaylight.mdsal.common.api.AsyncDataChangeEvent;
import org.opendaylight.mdsal.common.api.AsyncDataBroker.DataChangeScope;
import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top;
final TestListener fooListener = createListener(CONFIGURATION, TOP_FOO, DataChangeScope.SUBTREE);
final TestListener barListener = createListener(CONFIGURATION, TOP_BAR, DataChangeScope.SUBTREE);
- final ReadWriteTransaction writeTx = getDataBroker().newReadWriteTransaction();
+ final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(CONFIGURATION, TOP, top(topLevelList(TOP_BAR_KEY)));
assertCommit(writeTx.submit());
final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> top = topListener.event();
final TestListener fooListener = createListener(CONFIGURATION, TOP_FOO, DataChangeScope.SUBTREE);
final TestListener barListener = createListener(CONFIGURATION, TOP_BAR, DataChangeScope.SUBTREE);
- final ReadWriteTransaction writeTx = getDataBroker().newReadWriteTransaction();
+ final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.merge(CONFIGURATION, TOP, top(topLevelList(TOP_BAR_KEY)));
assertCommit(writeTx.submit());
final TestListener fooListener = createListener(CONFIGURATION, TOP_FOO, DataChangeScope.SUBTREE);
final TestListener barListener = createListener(CONFIGURATION, TOP_BAR, DataChangeScope.SUBTREE);
- final ReadWriteTransaction writeTx = getDataBroker().newReadWriteTransaction();
+ final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(CONFIGURATION, TOP_BAR, topLevelList(TOP_BAR_KEY));
assertCommit(writeTx.submit());
final TestListener fooListener = createListener(CONFIGURATION, TOP_FOO, DataChangeScope.SUBTREE);
final TestListener barListener = createListener(CONFIGURATION, TOP_BAR, DataChangeScope.SUBTREE);
- final ReadWriteTransaction writeTx = getDataBroker().newReadWriteTransaction();
+ final WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.merge(CONFIGURATION, TOP_BAR, topLevelList(TOP_BAR_KEY));
assertCommit(writeTx.submit());
* <ul>
* <li>Read-Only - allocated using {@link #newReadOnlyTransaction()}
* <li>Write-Only - allocated using {@link #newWriteOnlyTransaction()}
- * <li>Read-Write - allocated using {@link #newReadWriteTransaction()}
* </ul>
*
* <p>
*
* <p>
* For a detailed explanation of how transaction are isolated and how transaction-local changes are
- * committed to global data tree, see {@link AsyncReadTransaction}, {@link AsyncWriteTransaction},
- * {@link AsyncReadWriteTransaction} and {@link AsyncWriteTransaction#submit()}.
+ * committed to global data tree, see {@link AsyncReadTransaction}, {@link AsyncWriteTransaction}
+ * and {@link AsyncWriteTransaction#submit()}.
*
*
* <p>
* @param <P> Type of path (subtree identifier), which represents location in tree
* @param <D> Type of data (payload), which represents data payload
*/
-public interface AsyncDataBroker<P extends Path<P>, D, L extends AsyncDataChangeListener<P, D>> extends //
+public interface AsyncDataBroker<P extends Path<P>, D, L extends AsyncDataChangeListener<P, D>> extends
AsyncDataTransactionFactory<P, D> {
/**
* {@inheritDoc}
*/
@Override
- public AsyncReadOnlyTransaction<P, D> newReadOnlyTransaction();
+ AsyncReadOnlyTransaction<P, D> newReadOnlyTransaction();
- /**
- * {@inheritDoc}
- */
- @Override
- public AsyncReadWriteTransaction<P, D> newReadWriteTransaction();
/**
* {@inheritDoc}
*/
@Override
- public AsyncWriteTransaction<P, D> newWriteOnlyTransaction();
+ AsyncWriteTransaction<P, D> newWriteOnlyTransaction();
/**
* Registers a {@link AsyncDataChangeListener} to receive
* <ul>
* <li>Read-Only - allocated using {@link #newReadOnlyTransaction()}
* <li>Write-Only - allocated using {@link #newWriteOnlyTransaction()}
- * <li>Read-Write - allocated using {@link #newReadWriteTransaction()}
* </ul>
*
* <p>
*
* <p>
* For a detailed explanation of how transaction are isolated and how transaction-local changes are
- * committed to global data tree, see {@link AsyncReadTransaction}, {@link AsyncWriteTransaction},
- * {@link AsyncReadWriteTransaction} and {@link AsyncWriteTransaction#submit()}.
+ * committed to global data tree, see {@link AsyncReadTransaction}, {@link AsyncWriteTransaction}
+ * and {@link AsyncWriteTransaction#submit()}.
*
* <p>
* It is strongly recommended to use the type of transaction, which provides only the minimal
*/
AsyncReadOnlyTransaction<P, D> newReadOnlyTransaction();
- /**
- * Allocates new read-write transaction which provides a mutable view of the data tree.
- *
- * <p>
- * Preconditions for mutation of data tree are captured from the snapshot of data tree state,
- * when the transaction is allocated. If data was changed during transaction in an incompatible
- * way then the commit of this transaction will fail. See {@link AsyncWriteTransaction#submit()}
- * for more details about conflicting and not-conflicting changes and failure scenarios.
- *
- * @return new read-write transaction
- */
- AsyncReadWriteTransaction<P, D> newReadWriteTransaction();
-
/**
* Allocates new write-only transaction based on latest state of data tree.
*
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.common.api;
-
-import org.opendaylight.yangtools.concepts.Path;
-
-/**
- * Transaction enabling a client to have a combined read/write capabilities.
- *
- * <p>
- * The initial state of the write transaction is stable snapshot of current data tree state captured
- * when transaction was created and it's state and underlying data tree are not affected by other
- * concurrently running transactions.
- *
- * <p>
- * Write transactions are isolated from other concurrent write transactions. All writes are local to
- * the transaction and represents only a proposal of state change for data tree and it is not
- * visible to any other concurrently running transactions.
- *
- * <p>
- * Applications publish the changes proposed in the transaction by calling {@link #submit()} on the
- * transaction. This seals the transaction (preventing any further writes using this transaction)
- * and submits it to be processed and applied to global conceptual data tree.
- *
- * <p>
- * The transaction commit may fail due to a concurrent transaction modifying and committing data in
- * an incompatible way. See {@link #submit()} for more concrete commit failure examples.
- *
- * <b>Implementation Note:</b> This interface is not intended to be implemented by users of MD-SAL,
- * but only to be consumed by them.
- *
- * <h2>Examples</h2>
- *
- * <h3>Transaction local state</h3>
- *
- * Let assume initial state of data tree for <code>PATH</code> is <code>A</code> .
- *
- * <pre>
- * txWrite = broker.newReadWriteTransaction(); // concurrent write transaction
- *
- * txWrite.read(OPERATIONAL,PATH).get() // will return Optional containing A
- * txWrite.put(OPERATIONAL,PATH,B); // writes B to PATH
- * txWrite.read(OPERATIONAL,PATH).get() // will return Optional Containing B
- *
- * txWrite.submit().get(); // data tree is updated, PATH contains B
- *
- * tx1afterCommit = broker.newReadOnlyTransaction(); // read Transaction is snapshot of new state
- * tx1afterCommit.read(OPERATIONAL,PATH).get(); // returns Optional containing B
- * </pre>
- *
- * As you could see read-write transaction provides capabilities as {@link AsyncWriteTransaction}
- * but also allows for reading proposed changes as if they already happened.
- *
- * <h3>Transaction isolation (read transaction, read-write transaction)</h3> Let assume initial
- * state of data tree for <code>PATH</code> is <code>A</code>.
- *
- * <pre>
- * txRead = broker.newReadOnlyTransaction(); // read Transaction is snapshot of data
- * txWrite = broker.newReadWriteTransaction(); // concurrent write transaction
- *
- * txRead.read(OPERATIONAL,PATH).get(); // will return Optional containing A
- * txWrite.read(OPERATIONAL,PATH).get() // will return Optional containing A
- *
- * txWrite.put(OPERATIONAL,PATH,B); // writes B to PATH
- * txWrite.read(OPERATIONAL,PATH).get() // will return Optional Containing B
- *
- * txRead.read(OPERATIONAL,PATH).get(); // concurrent read transaction still returns
- * // Optional containing A
- *
- * txWrite.submit().get(); // data tree is updated, PATH contains B
- * txRead.read(OPERATIONAL,PATH).get(); // still returns Optional containing A
- *
- * tx1afterCommit = broker.newReadOnlyTransaction(); // read Transaction is snapshot of new state
- * tx1afterCommit.read(OPERATIONAL,PATH).get(); // returns Optional containing B
- * </pre>
- *
- * <h3>Transaction isolation (2 concurrent read-write transactions)</h3> Let assume initial state of
- * data tree for <code>PATH</code> is <code>A</code>.
- *
- * <pre>
- * tx1 = broker.newReadWriteTransaction(); // read Transaction is snapshot of data
- * tx2 = broker.newReadWriteTransaction(); // concurrent write transaction
- *
- * tx1.read(OPERATIONAL,PATH).get(); // will return Optional containing A
- * tx2.read(OPERATIONAL,PATH).get() // will return Optional containing A
- *
- * tx2.put(OPERATIONAL,PATH,B); // writes B to PATH
- * tx2.read(OPERATIONAL,PATH).get() // will return Optional Containing B
- *
- * tx1.read(OPERATIONAL,PATH).get(); // tx1 read-write transaction still sees Optional
- * // containing A since is isolated from tx2
- * tx1.put(OPERATIONAL,PATH,C); // writes C to PATH
- * tx1.read(OPERATIONAL,PATH).get() // will return Optional Containing C
- *
- * tx2.read(OPERATIONAL,PATH).get() // tx2 read-write transaction still sees Optional
- * // containing B since is isolated from tx1
- *
- * tx2.submit().get(); // data tree is updated, PATH contains B
- * tx1.read(OPERATIONAL,PATH).get(); // still returns Optional containing C since is isolated from tx2
- *
- * tx1afterCommit = broker.newReadOnlyTransaction(); // read Transaction is snapshot of new state
- * tx1afterCommit.read(OPERATIONAL,PATH).get(); // returns Optional containing B
- *
- * tx1.submit() // Will fail with OptimisticLockFailedException
- * // which means concurrent transaction changed the same PATH
- *
- * </pre>
- *
- * <p>
- * <b>Note:</b> examples contains blocking calls on future only to illustrate that action happened
- * after other asynchronous action. Use of blocking call
- * {@link com.google.common.util.concurrent.ListenableFuture#get()} is discouraged for most uses and
- * you should use
- * {@link com.google.common.util.concurrent.Futures#addCallback(com.google.common.util.concurrent.ListenableFuture, com.google.common.util.concurrent.FutureCallback)}
- * or other functions from {@link com.google.common.util.concurrent.Futures} to register more
- * specific listeners.
- *
- * @see AsyncReadTransaction
- * @see AsyncWriteTransaction
- *
- * @param <P> Type of path (subtree identifier), which represents location in tree
- * @param <D> Type of data (payload), which represents data payload
- */
-public interface AsyncReadWriteTransaction<P extends Path<P>, D> extends AsyncReadTransaction<P, D>,
- AsyncWriteTransaction<P, D> {
-
-}
* <ul>
* <li>{@link AsyncReadTransaction} - Read capabilities, user is able to read data from data tree</li>
* <li>{@link AsyncWriteTransaction} - Write capabilities, user is able to propose changes to data tree</li>
- * <li>{@link AsyncReadWriteTransaction} - Read and Write capabilities, user is able to read state and to propose changes of state.</li>
* </ul>
*
* <b>Implementation Note:</b> This interface is not intended to be implemented
* @param <P> Type of path (subtree identifier), which represents location in tree
* @param <D> Type of data (payload), which represents data payload
*/
-public interface AsyncTransaction<P extends Path<P>,D> extends //
- Identifiable<Object> {
+public interface AsyncTransaction<P extends Path<P>,D> extends Identifiable<Object> {
@Override
- public Object getIdentifier();
+ Object getIdentifier();
}
@Override
public AsyncReadOnlyTransaction<P, D> newReadOnlyTransaction();
- /**
- * Create a new read-write transaction which will continue the chain.
- *
- * <p>
- * The previous write transaction has to be either SUBMITTED
- * ({@link AsyncWriteTransaction#submit submit} was invoked) or CANCELLED
- * ({@link #close close} was invoked).
- * <p>
- * The returned read-write transaction presents an isolated view of the data if the previous
- * write transaction was successful - in other words, this read-write transaction will see the
- * state changes made by the previous write transaction in the chain. However, state which
- * was introduced by other transactions outside this transaction chain after creation of
- * the previous transaction is not visible.
- * <p>
- * Committing this read-write transaction using {@link AsyncWriteTransaction#submit submit}
- * will submit the state changes in this transaction to be visible to any subsequent
- * transaction in this chain and also to any transaction outside this chain.
- *
- * @return New transaction in the chain.
- * @throws IllegalStateException
- * if the previous transaction was not SUBMITTED or CANCELLED.
- * @throws TransactionChainClosedException
- * if the chain has been closed.
- */
- @Override
- public AsyncReadWriteTransaction<P, D> newReadWriteTransaction();
-
/**
* Create a new write-only transaction which will continue the chain.
*
@Override
DOMDataReadOnlyTransaction newReadOnlyTransaction();
- /**
- * {@inheritDoc}
- */
- @Override
- DOMDataReadWriteTransaction newReadWriteTransaction();
-
/**
* {@inheritDoc}
*/
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.dom.api;
-
-import org.opendaylight.mdsal.common.api.AsyncReadWriteTransaction;
-
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-
-public interface DOMDataReadWriteTransaction extends DOMDataReadTransaction, DOMDataWriteTransaction, AsyncReadWriteTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
-
-}
@Override
DOMDataReadOnlyTransaction newReadOnlyTransaction();
- @Override
- DOMDataReadWriteTransaction newReadWriteTransaction();
-
@Override
DOMDataWriteTransaction newWriteOnlyTransaction();
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
import org.opendaylight.mdsal.dom.api.DOMDataReadOnlyTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
return new DOMForwardedWriteTransaction<DOMStoreWriteTransaction>(newTransactionIdentifier(), txns, this);
}
- /**
- * Creates a new composite write-only transaction
- *
- * <p>
- * Creates a new composite write-only transaction backed by one write-only transaction per
- * factory in {@link #getTxFactories()}.
- * <p>
- * Implementation of composite Write-only transaction is following:
- *
- * <ul>
- * <li>
- * {@link DOMDataWriteTransaction#put(LogicalDatastoreType, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)}
- * - backing subtransaction is selected by {@link LogicalDatastoreType},
- * {@link DOMStoreWriteTransaction#write(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)}
- * is invoked on selected subtransaction.</li>
- * <li>
- * {@link DOMDataWriteTransaction#merge(LogicalDatastoreType, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)}
- * - backing subtransaction is selected by {@link LogicalDatastoreType},
- * {@link DOMStoreWriteTransaction#merge(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)}
- * is invoked on selected subtransaction.</li>
- * <li>
- * {@link DOMDataWriteTransaction#delete(LogicalDatastoreType, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)}
- * - backing subtransaction is selected by {@link LogicalDatastoreType},
- * {@link DOMStoreWriteTransaction#delete(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)}
- * is invoked on selected subtransaction.</li>
- * <li> {@link DOMDataWriteTransaction#submit()} - results in invoking
- * {@link DOMStoreWriteTransaction#ready()}, gathering all resulting cohorts and then invoking
- * finalized implementation callback {@link #submit(DOMDataWriteTransaction, Collection)} with
- * transaction which was commited and gathered results.</li>
- * </ul>
- *
- * Id of returned transaction is generated via {@link #newTransactionIdentifier()}.
- *
- * @return New composite read-write transaction associated with this factory.
- */
- public final DOMDataReadWriteTransaction newReadWriteTransaction() {
- checkNotClosed();
-
- final Map<LogicalDatastoreType, DOMStoreReadWriteTransaction> txns = new EnumMap<>(LogicalDatastoreType.class);
- for (final Entry<LogicalDatastoreType, T> store : storeTxFactories.entrySet()) {
- txns.put(store.getKey(), store.getValue().newReadWriteTransaction());
- }
- return new DOMForwardedReadWriteTransaction(newTransactionIdentifier(), txns, this);
- }
-
/**
* Convenience accessor of backing factories intended to be used only by
* finalization of this class.
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.mdsal.dom.broker;
-
-import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
-
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.ReadFailedException;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-import java.util.Map;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-
-/**
- *
- * Read-Write Transaction, which is composed of several {@link DOMStoreReadWriteTransaction}
- * transactions. Subtransaction is selected by {@link LogicalDatastoreType} type parameter in:
- *
- * <ul>
- * <li>{@link #read(LogicalDatastoreType, YangInstanceIdentifier)}
- * <li>{@link #put(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
- * <li>{@link #delete(LogicalDatastoreType, YangInstanceIdentifier)}
- * <li>{@link #merge(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
- * </ul>
- * {@link #submit()} will result in invocation of
- * {@link DOMDataCommitImplementation#submit(org.opendaylight.mdsal.dom.api.DOMDataWriteTransaction, Iterable)}
- * invocation with all
- * {@link org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort} for
- * underlying transactions.
- *
- */
-final class DOMForwardedReadWriteTransaction extends DOMForwardedWriteTransaction<DOMStoreReadWriteTransaction> implements DOMDataReadWriteTransaction {
- protected DOMForwardedReadWriteTransaction(final Object identifier,
- final Map<LogicalDatastoreType, DOMStoreReadWriteTransaction> backingTxs,
- final AbstractDOMForwardedTransactionFactory<?> commitImpl) {
- super(identifier, backingTxs, commitImpl);
- }
-
- @Override
- public CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> read(
- final LogicalDatastoreType store, final YangInstanceIdentifier path) {
- return getSubtransaction(store).read(path);
- }
-
- @Override
- public CheckedFuture<Boolean, ReadFailedException> exists(
- final LogicalDatastoreType store,
- final YangInstanceIdentifier path) {
- return getSubtransaction(store).exists(path);
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.dom.broker;
-
-import org.opendaylight.mdsal.dom.spi.ForwardingDOMDataBroker;
-
-import org.opendaylight.mdsal.common.api.TransactionChainListener;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeService;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-
-/**
- * An implementation of a {@link DOMDataBroker}, which forwards most requests to a delegate.
- *
- * Its interpretation of the API contract is somewhat looser, specifically it does not
- * guarantee transaction ordering between transactions allocated directly from the broker
- * and its transaction chains.
- */
-public final class PingPongDataBroker extends ForwardingDOMDataBroker implements AutoCloseable, DOMDataTreeChangeService {
- private final DOMDataBroker delegate;
-
- /**
- * Instantiate a new broker, backed by the the specified delegate
- * {@link DOMDataBroker}.
- *
- * @param delegate Backend broker, may not be null.
- */
- public PingPongDataBroker(@Nonnull final DOMDataBroker delegate) {
- this.delegate = Preconditions.checkNotNull(delegate);
- }
-
- @Override
- protected DOMDataBroker delegate() {
- return delegate;
- }
-
- @Override
- public PingPongTransactionChain createTransactionChain(final TransactionChainListener listener) {
- return new PingPongTransactionChain(delegate, listener);
- }
-
- @Override
- public void close() {
- // TODO Auto-generated method stub
- }
-
- @Override
- public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(final DOMDataTreeIdentifier treeId, final L listener) {
- final DOMDataTreeChangeService treeService =
- (DOMDataTreeChangeService) delegate.getSupportedExtensions().get(DOMDataTreeChangeService.class);
- if(treeService != null) {
- return treeService.registerDataTreeChangeListener(treeId, listener);
- }
- throw new UnsupportedOperationException("Delegate " + delegate + " does not support required functionality");
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.dom.broker;
-
-import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
-
-import com.google.common.util.concurrent.AbstractCheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * A {@link java.util.concurrent.Future} used to report the status of an future
- * {@link java.util.concurrent.Future}.
- */
-final class PingPongFuture extends AbstractCheckedFuture<Void, TransactionCommitFailedException> {
- protected PingPongFuture(final ListenableFuture<Void> delegate) {
- super(delegate);
- }
-
- @Override
- protected TransactionCommitFailedException mapException(final Exception e) {
- if (e.getCause() instanceof TransactionCommitFailedException){
- return (TransactionCommitFailedException) e.getCause();
- } else {
- return new TransactionCommitFailedException(e.getMessage(), e.getCause());
- }
- }
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.dom.broker;
-
-import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.SettableFuture;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
-
-/**
- * Transaction context. Tracks the relationship with the backend transaction.
- * We never leak this class to the user and have it implement the {@link FutureCallback}
- * interface so we have a simple way of propagating the result.
- */
-final class PingPongTransaction implements FutureCallback<Void> {
- private final CheckedFuture<Void, TransactionCommitFailedException> submitFuture;
- private final DOMDataReadWriteTransaction delegate;
- private final SettableFuture<Void> future;
- private DOMDataReadWriteTransaction frontendTransaction;
-
- PingPongTransaction(final DOMDataReadWriteTransaction delegate) {
- this.delegate = Preconditions.checkNotNull(delegate);
- future = SettableFuture.create();
- submitFuture = new PingPongFuture(future);
- }
-
- DOMDataReadWriteTransaction getTransaction() {
- return delegate;
- }
-
- DOMDataReadWriteTransaction getFrontendTransaction() {
- return frontendTransaction;
- }
-
- CheckedFuture<Void, TransactionCommitFailedException> getSubmitFuture() {
- return submitFuture;
- }
-
- @Override
- public void onSuccess(final Void result) {
- future.set(result);
- }
-
- @Override
- public void onFailure(final Throwable t) {
- future.setException(t);
- }
-
- void recordFrontendTransaction(final DOMDataReadWriteTransaction tx) {
- if (frontendTransaction != null) {
- frontendTransaction = tx;
- }
- }
-
- @Override
- public String toString() {
- return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
- }
-
- protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
- return toStringHelper.add("delegate", delegate);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.dom.broker;
-
-import org.opendaylight.mdsal.dom.spi.ForwardingDOMDataReadWriteTransaction;
-
-import org.opendaylight.mdsal.common.api.AsyncTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.ReadFailedException;
-import org.opendaylight.mdsal.common.api.TransactionChain;
-import org.opendaylight.mdsal.common.api.TransactionChainListener;
-import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import javax.annotation.Nonnull;
-import javax.annotation.concurrent.GuardedBy;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMDataReadOnlyTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An implementation of {@link DOMTransactionChain}, which has a very specific
- * behavior, which some users may find surprising. If keeps the general
- * intent of the contract, but it makes sure there are never more than two
- * transactions allocated at any given time: one of them is being committed,
- * and while that is happening, the other one acts as the scratch pad. Once
- * the committing transaction completes successfully, the scratch transaction
- * is enqueued as soon as it is ready.
- *
- * This mode of operation means that there is no inherent isolation between
- * the front-end transactions and transactions cannot be reasonably cancelled.
- *
- * It furthermore means that the transactions returned by {@link #newReadOnlyTransaction()}
- * counts as an outstanding transaction and the user may not allocate multiple
- * read-only transactions at the same time.
- */
-public final class PingPongTransactionChain implements DOMTransactionChain {
- private static final Logger LOG = LoggerFactory.getLogger(PingPongTransactionChain.class);
- private final DOMTransactionChain delegate;
-
- @GuardedBy("this")
- private boolean failed;
-
- /**
- * This updater is used to manipulate the "ready" transaction. We perform only atomic
- * get-and-set on it.
- */
- private static final AtomicReferenceFieldUpdater<PingPongTransactionChain, PingPongTransaction> READY_UPDATER =
- AtomicReferenceFieldUpdater.newUpdater(PingPongTransactionChain.class, PingPongTransaction.class, "readyTx");
- private volatile PingPongTransaction readyTx;
-
- /**
- * This updater is used to manipulate the "locked" transaction. A locked transaction
- * means we know that the user still holds a transaction and should at some point call
- * us. We perform on compare-and-swap to ensure we properly detect when a user is
- * attempting to allocated multiple transactions concurrently.
- */
- private static final AtomicReferenceFieldUpdater<PingPongTransactionChain, PingPongTransaction> LOCKED_UPDATER =
- AtomicReferenceFieldUpdater.newUpdater(PingPongTransactionChain.class, PingPongTransaction.class, "lockedTx");
- private volatile PingPongTransaction lockedTx;
-
- /**
- * This updater is used to manipulate the "inflight" transaction. There can be at most
- * one of these at any given time. We perform only compare-and-swap on these.
- */
- private static final AtomicReferenceFieldUpdater<PingPongTransactionChain, PingPongTransaction> INFLIGHT_UPDATER =
- AtomicReferenceFieldUpdater.newUpdater(PingPongTransactionChain.class, PingPongTransaction.class, "inflightTx");
- private volatile PingPongTransaction inflightTx;
-
- PingPongTransactionChain(final DOMDataBroker broker, final TransactionChainListener listener) {
- this.delegate = broker.createTransactionChain(new TransactionChainListener() {
- @Override
- public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction, final Throwable cause) {
- LOG.debug("Delegate chain {} reported failure in {}", chain, transaction, cause);
-
- final DOMDataReadWriteTransaction frontend;
- final PingPongTransaction tx = inflightTx;
- if (tx == null) {
- LOG.warn("Transaction chain {} failed with no pending transactions", chain);
- frontend = null;
- } else {
- frontend = tx.getFrontendTransaction();
- }
-
- listener.onTransactionChainFailed(PingPongTransactionChain.this, frontend, cause);
- delegateFailed();
- }
-
- @Override
- public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
- listener.onTransactionChainSuccessful(PingPongTransactionChain.this);
- }
- });
- }
-
- private synchronized void delegateFailed() {
- failed = true;
-
- /*
- * If we do not have a locked transaction, we need to ensure that
- * the backend transaction is cancelled. Otherwise we can defer
- * until the user calls us.
- */
- if (lockedTx == null) {
- processIfReady();
- }
- }
-
- private synchronized PingPongTransaction slowAllocateTransaction() {
- final DOMDataReadWriteTransaction delegateTx = delegate.newReadWriteTransaction();
- final PingPongTransaction newTx = new PingPongTransaction(delegateTx);
-
- if (!LOCKED_UPDATER.compareAndSet(this, null, newTx)) {
- delegateTx.cancel();
- throw new IllegalStateException(String.format("New transaction %s raced with transacion %s", newTx, lockedTx));
- }
-
- return newTx;
- }
-
- private PingPongTransaction allocateTransaction() {
- // Step 1: acquire current state
- final PingPongTransaction oldTx = READY_UPDATER.getAndSet(this, null);
-
- // Slow path: allocate a delegate transaction
- if (oldTx == null) {
- return slowAllocateTransaction();
- }
-
- // Fast path: reuse current transaction. We will check
- // failures and similar on submit().
- if (!LOCKED_UPDATER.compareAndSet(this, null, oldTx)) {
- // Ouch. Delegate chain has not detected a duplicate
- // transaction allocation. This is the best we can do.
- oldTx.getTransaction().cancel();
- throw new IllegalStateException(String.format("Reusable transaction %s raced with transaction %s", oldTx, lockedTx));
- }
-
- return oldTx;
- }
-
- /*
- * This forces allocateTransaction() on a slow path, which has to happen after
- * this method has completed executing. Also inflightTx may be updated outside
- * the lock, hence we need to re-check.
- */
- @GuardedBy("this")
- private void processIfReady() {
- if (inflightTx == null) {
- final PingPongTransaction tx = READY_UPDATER.getAndSet(this, null);
- if (tx != null) {
- processTransaction(tx);
- }
- }
- }
-
- /**
- * Process a ready transaction. The caller needs to ensure that
- * each transaction is seen only once by this method.
- *
- * @param tx Transaction which needs processing.
- */
- @GuardedBy("this")
- private void processTransaction(@Nonnull final PingPongTransaction tx) {
- if (failed) {
- LOG.debug("Cancelling transaction {}", tx);
- tx.getTransaction().cancel();
- return;
- }
-
- LOG.debug("Submitting transaction {}", tx);
- if (!INFLIGHT_UPDATER.compareAndSet(this, null, tx)) {
- LOG.warn("Submitting transaction {} while {} is still running", tx, inflightTx);
- }
-
- Futures.addCallback(tx.getTransaction().submit(), new FutureCallback<Void>() {
- @Override
- public void onSuccess(final Void result) {
- transactionSuccessful(tx, result);
- }
-
- @Override
- public void onFailure(final Throwable t) {
- transactionFailed(tx, t);
- }
- });
- }
-
- private void transactionSuccessful(final PingPongTransaction tx, final Void result) {
- LOG.debug("Transaction {} completed successfully", tx);
-
- final boolean success = INFLIGHT_UPDATER.compareAndSet(this, tx, null);
- Preconditions.checkState(success, "Successful transaction %s while %s was submitted", tx, inflightTx);
-
- synchronized (this) {
- processIfReady();
- }
-
- // Can run unsynchronized
- tx.onSuccess(result);
- }
-
- private void transactionFailed(final PingPongTransaction tx, final Throwable t) {
- LOG.debug("Transaction {} failed", tx, t);
-
- final boolean success = INFLIGHT_UPDATER.compareAndSet(this, tx, null);
- Preconditions.checkState(success, "Failed transaction %s while %s was submitted", tx, inflightTx);
-
- tx.onFailure(t);
- }
-
- private void readyTransaction(@Nonnull final PingPongTransaction tx) {
- // First mark the transaction as not locked.
- final boolean lockedMatch = LOCKED_UPDATER.compareAndSet(this, tx, null);
- Preconditions.checkState(lockedMatch, "Attempted to submit transaction %s while we have %s", tx, lockedTx);
- LOG.debug("Transaction {} unlocked", tx);
-
- /*
- * The transaction is ready. It will then be picked up by either next allocation,
- * or a background transaction completion callback.
- */
- final boolean success = READY_UPDATER.compareAndSet(this, null, tx);
- Preconditions.checkState(success, "Transaction %s collided on ready state", tx, readyTx);
- LOG.debug("Transaction {} readied", tx);
-
- /*
- * We do not see a transaction being in-flight, so we need to take care of dispatching
- * the transaction to the backend. We are in the ready case, we cannot short-cut
- * the checking of readyTx, as an in-flight transaction may have completed between us
- * setting the field above and us checking.
- */
- if (inflightTx == null) {
- synchronized (this) {
- processIfReady();
- }
- }
- }
-
- @Override
- public synchronized void close() {
- final PingPongTransaction notLocked = lockedTx;
- Preconditions.checkState(notLocked == null, "Attempted to close chain with outstanding transaction %s", notLocked);
-
- // Force allocations on slow path. We will complete the rest
- final PingPongTransaction tx = READY_UPDATER.getAndSet(this, null);
-
- // Make sure no transaction is outstanding. Otherwise sleep a bit and retry
- while (inflightTx != null) {
- LOG.debug("Busy-waiting for in-flight transaction {} to complete", inflightTx);
- Thread.yield();
- continue;
- }
-
- // If we have an outstanding transaction, send it down
- if (tx != null) {
- processTransaction(tx);
- }
-
- // All done, close the delegate. All new allocations should fail.
- delegate.close();
- }
-
- @Override
- public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
- final PingPongTransaction tx = allocateTransaction();
-
- return new DOMDataReadOnlyTransaction() {
- @Override
- public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
- final YangInstanceIdentifier path) {
- return tx.getTransaction().read(store, path);
- }
-
- @Override
- public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store,
- final YangInstanceIdentifier path) {
- return tx.getTransaction().exists(store, path);
- }
-
- @Override
- public Object getIdentifier() {
- return tx.getTransaction().getIdentifier();
- }
-
- @Override
- public void close() {
- readyTransaction(tx);
- }
- };
- }
-
- @Override
- public DOMDataReadWriteTransaction newReadWriteTransaction() {
- final PingPongTransaction tx = allocateTransaction();
- final DOMDataReadWriteTransaction ret = new ForwardingDOMDataReadWriteTransaction() {
- @Override
- protected DOMDataReadWriteTransaction delegate() {
- return tx.getTransaction();
- }
-
- @Override
- public CheckedFuture<Void, TransactionCommitFailedException> submit() {
- readyTransaction(tx);
- return tx.getSubmitFuture();
- }
-
- @Override
- public boolean cancel() {
- throw new UnsupportedOperationException("Transaction cancellation is not supported");
- }
- };
-
- tx.recordFrontendTransaction(ret);
- return ret;
- }
-
- @Override
- public DOMDataWriteTransaction newWriteOnlyTransaction() {
- return newReadWriteTransaction();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.mdsal.dom.broker.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
-import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.OPERATIONAL;
-
-import org.opendaylight.mdsal.dom.broker.test.util.TestModel;
-
-import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore;
-import org.opendaylight.mdsal.dom.spi.store.DOMStore;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.dom.broker.AbstractDOMDataBroker;
-import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMDataReadTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executors;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DOMBrokerPerformanceTest {
-
- private static final Logger log = LoggerFactory.getLogger(DOMBrokerPerformanceTest.class);
-
- private static NormalizedNode<?, ?> outerList(final int i) {
- return ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, i);
- }
-
- private static YangInstanceIdentifier outerListPath(final int i) {
- return YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)//
- .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, i) //
- .build();
- }
-
- private SchemaContext schemaContext;
- private AbstractDOMDataBroker domBroker;
-
- private static <V> V measure(final String name, final Callable<V> callable) throws Exception {
- // TODO Auto-generated method stub
- log.debug("Measurement:{} Start", name);
- long startNano = System.nanoTime();
- try {
- return callable.call();
- } finally {
- long endNano = System.nanoTime();
- log.info("Measurement:\"{}\" Time:{} ms", name, (endNano - startNano) / 1000000.0d);
- }
- }
-
- @Before
- public void setupStore() {
- InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", MoreExecutors.newDirectExecutorService());
- InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", MoreExecutors.newDirectExecutorService());
- schemaContext = TestModel.createTestContext();
-
- operStore.onGlobalContextUpdated(schemaContext);
- configStore.onGlobalContextUpdated(schemaContext);
-
- ImmutableMap<LogicalDatastoreType, DOMStore> stores = ImmutableMap.<LogicalDatastoreType, DOMStore> builder() //
- .put(CONFIGURATION, configStore) //
- .put(OPERATIONAL, operStore) //
- .build();
- ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
- domBroker = new SerializedDOMDataBroker(stores, executor);
- }
-
- @Test
- public void testPerformance() throws Exception {
- measure("Test Suite (all tests)", new Callable<Void>() {
-
- @Override
- public Void call() throws Exception {
- smallTestSuite(10, 1000);
- //smallTestSuite(10, 100);
- smallTestSuite(100, 100);
- //smallTestSuite(100, 100);
- //smallTestSuite(1000, 10);
- smallTestSuite(1000, 10);
- //smallTestSuite(1000, 1000);
- return null;
- }
- });
- }
-
- private void smallTestSuite(final int txNum, final int innerListWriteNum) throws Exception {
- measure("TestSuite (Txs:" + txNum + " innerWrites:" + innerListWriteNum + ")", new Callable<Void>() {
-
- @Override
- public Void call() throws Exception {
- measureOneTransactionTopContainer();
- measureSeparateWritesOneLevel(txNum, innerListWriteNum);
- return null;
- }
- });
- }
-
- private void measureSeparateWritesOneLevel(final int txNum, final int innerNum) throws Exception {
- final List<DOMDataReadWriteTransaction> transactions = measure("Txs:"+ txNum + " Allocate",
- new Callable<List<DOMDataReadWriteTransaction>>() {
- @Override
- public List<DOMDataReadWriteTransaction> call() throws Exception {
- List<DOMDataReadWriteTransaction> builder = new ArrayList<>(txNum);
- for (int i = 0; i < txNum; i++) {
- DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
- builder.add(writeTx);
- }
- return builder;
- }
- });
- assertEquals(txNum, transactions.size());
- measure("Txs:"+ txNum + " Writes:1", new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- int i = 0;
- for (DOMDataReadWriteTransaction writeTx :transactions) {
- // Writes /test/outer-list/i in writeTx
- writeTx.put(OPERATIONAL, outerListPath(i), outerList(i));
- i++;
- }
- return null;
- }
- });
-
- measure("Txs:"+ txNum + " Writes:" + innerNum, new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- int i = 0;
- for (DOMDataReadWriteTransaction writeTx :transactions) {
- // Writes /test/outer-list/i in writeTx
- YangInstanceIdentifier path = YangInstanceIdentifier.builder(outerListPath(i))
- .node(TestModel.INNER_LIST_QNAME).build();
- writeTx.put(OPERATIONAL, path, ImmutableNodes.mapNodeBuilder(TestModel.INNER_LIST_QNAME).build());
- for (int j = 0; j < innerNum; j++) {
- YangInstanceIdentifier innerPath = YangInstanceIdentifier.builder(path)
- .nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, String.valueOf(j))
- .build();
- writeTx.put(
- OPERATIONAL,
- innerPath,
- ImmutableNodes.mapEntry(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME,
- String.valueOf(j)));
- }
- i++;
- }
- return null;
- }
- });
-
- measure("Txs:" + txNum + " Submit, Finish", new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- List<ListenableFuture<?>> allFutures = measure(txNum + " Submits",
- new Callable<List<ListenableFuture<?>>>() {
- @Override
- public List<ListenableFuture<?>> call() throws Exception {
- List<ListenableFuture<?>> builder = new ArrayList<>(txNum);
- for (DOMDataReadWriteTransaction tx :transactions) {
- builder.add(tx.submit());
- }
- return builder;
- }
- });
- Futures.allAsList(allFutures).get();
- return null;
- }
- });
-
- final DOMDataReadTransaction readTx = measure("Txs:1 (ro), Allocate", new Callable<DOMDataReadTransaction>() {
- @Override
- public DOMDataReadTransaction call() throws Exception {
- return domBroker.newReadOnlyTransaction();
-
- }
- });
-
-
- measure("Txs:1 (ro) Reads:" + txNum + " (1-level)" , new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- for (int i = 0; i < txNum; i++) {
- ListenableFuture<Optional<NormalizedNode<?, ?>>> potential = readTx.read(OPERATIONAL,
- outerListPath(i));
- assertTrue("outerList/" + i, potential.get().isPresent());
- }
- return null;
- }
- });
-
- measure("Txs:1 (ro) Reads:" + txNum * innerNum + " (2-level)", new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- for (int i = 0; i < txNum; i++) {
- for (int j = 0; j < innerNum; j++) {
- YangInstanceIdentifier path = YangInstanceIdentifier
- .builder(outerListPath(i))
- //
- .node(TestModel.INNER_LIST_QNAME)
- .nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, String.valueOf(j))
- .build();
- ListenableFuture<Optional<NormalizedNode<?, ?>>> potential = readTx.read(OPERATIONAL, path);
- assertTrue("outer-list/" + i + "/inner-list/" + j, potential.get().isPresent());
- }
- }
- return null;
- }
- });
- }
-
- private void measureOneTransactionTopContainer() throws Exception {
-
- final DOMDataReadWriteTransaction writeTx = measure("Txs:1 Allocate", new Callable<DOMDataReadWriteTransaction>() {
- @Override
- public DOMDataReadWriteTransaction call() throws Exception {
- return domBroker.newReadWriteTransaction();
- }
- });
-
- measure("Txs:1 Write", new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- writeTx.put(OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
- writeTx.put(OPERATIONAL, TestModel.OUTER_LIST_PATH,
- ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
- return null;
- }
- });
-
- measure("Txs:1 Reads:1", new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- // Reads /test in writeTx
- ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(OPERATIONAL,
- TestModel.TEST_PATH);
- assertTrue(writeTxContainer.get().isPresent());
- return null;
- }
- });
-
- measure("Txs:1 Reads:1", new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- // Reads /test in writeTx
- ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(OPERATIONAL,
- TestModel.TEST_PATH);
- assertTrue(writeTxContainer.get().isPresent());
- return null;
- }
- });
-
- measure("Txs:1 Submit, Finish", new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- measure("Txs:1 Submit", new Callable<ListenableFuture<?>>() {
- @Override
- public ListenableFuture<?> call() throws Exception {
- return writeTx.submit();
- }
- }).get();
- return null;
- }
- });
- }
-}
import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
import org.opendaylight.mdsal.dom.api.DOMDataChangeListener;
import org.opendaylight.mdsal.dom.api.DOMDataReadTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMDataWriteTransaction;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
DOMDataReadTransaction readTx = domBroker.newReadOnlyTransaction();
assertNotNull(readTx);
- DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
+ DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
assertNotNull(writeTx);
/**
*
*/
writeTx.put(OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
- /**
- *
- * Reads /test from writeTx Read should return container.
- *
- */
- ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(OPERATIONAL,
- TestModel.TEST_PATH);
- assertTrue(writeTxContainer.get().isPresent());
/**
*
@Test(timeout=10000)
public void testTransactionCommit() throws InterruptedException, ExecutionException {
- DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
+ DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
assertNotNull(writeTx);
/**
*
*/
writeTx.put(OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
- /**
- *
- * Reads /test from writeTx Read should return container.
- *
- */
- ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(OPERATIONAL,
- TestModel.TEST_PATH);
- assertTrue(writeTxContainer.get().isPresent());
-
writeTx.submit().get();
Optional<NormalizedNode<?, ?>> afterCommitRead = domBroker.newReadOnlyTransaction()
Mockito.doReturn( true ).when( commitExecutor.delegate )
.awaitTermination( Mockito.anyLong(), Mockito.any( TimeUnit.class ) );
- DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
+ DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put( OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME) );
writeTx.submit().checkedGet( 5, TimeUnit.SECONDS );
import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.OPERATIONAL;
import org.opendaylight.mdsal.dom.broker.test.util.TestModel;
-
import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore;
import org.opendaylight.mdsal.dom.spi.store.DOMStore;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.dom.broker.AbstractDOMDataBroker;
import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
import org.opendaylight.mdsal.dom.api.DOMDataReadTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
+import org.opendaylight.mdsal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
+
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
*
*
*/
- DOMDataReadWriteTransaction firstTx = allocateAndWrite(txChain);
+ DOMDataWriteTransaction firstTx = allocateAndWrite(txChain);
/**
* First transaction is marked as ready, we are able to allocate chained
* is read-write.
*
*/
- DOMDataReadWriteTransaction thirdDeleteTx = allocateAndDelete(txChain);
+ DOMDataWriteTransaction thirdDeleteTx = allocateAndDelete(txChain);
/**
* We commit first transaction
}
}
- private static DOMDataReadWriteTransaction allocateAndDelete(final DOMTransactionChain txChain)
+ private static DOMDataWriteTransaction allocateAndDelete(final DOMTransactionChain txChain)
throws InterruptedException, ExecutionException {
- DOMDataReadWriteTransaction tx = txChain.newReadWriteTransaction();
-
- /**
- * We test existence of /test in third transaction container should
- * still be visible from first one (which is still uncommmited).
- *
- */
- assertTestContainerExists(tx);
-
+ DOMDataWriteTransaction tx = txChain.newWriteOnlyTransaction();
/**
* We delete node in third transaction
*/
return tx;
}
- private static DOMDataReadWriteTransaction allocateAndWrite(final DOMTransactionChain txChain)
+ private static DOMDataWriteTransaction allocateAndWrite(final DOMTransactionChain txChain)
throws InterruptedException, ExecutionException {
- DOMDataReadWriteTransaction tx = txChain.newReadWriteTransaction();
- assertTestContainerWrite(tx);
+ DOMDataWriteTransaction tx = txChain.newWriteOnlyTransaction();
+ writeTestContainer(tx);
return tx;
}
assertTrue(readedData.isPresent());
}
- private static void assertTestContainerWrite(final DOMDataReadWriteTransaction tx) throws InterruptedException,
+ private static void writeTestContainer(final DOMDataWriteTransaction tx) throws InterruptedException,
ExecutionException {
tx.put(OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
- assertTestContainerExists(tx);
}
}
import org.opendaylight.mdsal.dom.api.DOMDataBrokerExtension;
import org.opendaylight.mdsal.dom.api.DOMDataChangeListener;
import org.opendaylight.mdsal.dom.api.DOMDataReadOnlyTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
import com.google.common.collect.ForwardingObject;
return delegate().newReadOnlyTransaction();
}
- @Override
- public DOMDataReadWriteTransaction newReadWriteTransaction() {
- return delegate().newReadWriteTransaction();
- }
-
@Override
public DOMDataWriteTransaction newWriteOnlyTransaction() {
return delegate().newWriteOnlyTransaction();
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.dom.spi;
-
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.ReadFailedException;
-import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ForwardingObject;
-import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-
-/**
- * Utility {@link DOMDataReadWriteTransaction} implementation which forwards all interface
- * method invocation to a delegate instance.
- */
-public abstract class ForwardingDOMDataReadWriteTransaction extends ForwardingObject implements DOMDataReadWriteTransaction {
- @Override
- protected abstract @Nonnull DOMDataReadWriteTransaction delegate();
-
- @Override
- public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
- return delegate().read(store, path);
- }
-
- @Override
- public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
- return delegate().exists(store, path);
- }
-
- @Override
- public Object getIdentifier() {
- return delegate().getIdentifier();
- }
-
- @Override
- public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
- delegate().put(store, path, data);
- }
-
- @Override
- public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
- delegate().merge(store, path, data);
- }
-
- @Override
- public boolean cancel() {
- return delegate().cancel();
- }
-
- @Override
- public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
- delegate().delete(store, path);
- }
-
- @Override
- public CheckedFuture<Void, TransactionCommitFailedException> submit() {
- return delegate().submit();
- }
-
-}
package org.opendaylight.mdsal.dom.spi;
import org.opendaylight.mdsal.dom.api.DOMDataReadOnlyTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
return delegate().newReadOnlyTransaction();
}
- @Override
- public DOMDataReadWriteTransaction newReadWriteTransaction() {
- return delegate().newReadWriteTransaction();
- }
-
@Override
public DOMDataWriteTransaction newWriteOnlyTransaction() {
return delegate().newWriteOnlyTransaction();