Removed ReadWriteTransaction concept from APIs. 45/27345/4
authorTony Tkacik <ttkacik@cisco.com>
Wed, 23 Sep 2015 12:21:23 +0000 (14:21 +0200)
committerRobert Varga <nite@hq.sk>
Sat, 26 Sep 2015 06:32:24 +0000 (06:32 +0000)
Change-Id: I0cdbb4b67806eb0374acd679ded07e57b436b724
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
32 files changed:
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/BindingTransactionChain.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/DataBroker.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/ReadOnlyTransaction.java
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/ReadTransaction.java [deleted file]
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/ReadWriteTransaction.java [deleted file]
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/TransactionFactory.java
binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/AbstractReadWriteTransaction.java [deleted file]
binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/BindingDOMDataBrokerAdapter.java
binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/BindingDOMReadWriteTransactionAdapter.java [deleted file]
binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/BindingDOMTransactionChainAdapter.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/test/Bug1333DataChangeListenerTest.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/test/ListInsertionDataChangeListenerTest.java
common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataBroker.java
common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataTransactionFactory.java
common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncReadWriteTransaction.java [deleted file]
common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncTransaction.java
common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionChain.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataBroker.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataReadWriteTransaction.java [deleted file]
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMTransactionChain.java
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/AbstractDOMForwardedTransactionFactory.java
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/DOMForwardedReadWriteTransaction.java [deleted file]
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongDataBroker.java [deleted file]
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongFuture.java [deleted file]
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongTransaction.java [deleted file]
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongTransactionChain.java [deleted file]
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/test/DOMBrokerPerformanceTest.java [deleted file]
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/test/DOMBrokerTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/test/DOMTransactionChainTest.java
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/ForwardingDOMDataBroker.java
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/ForwardingDOMDataReadWriteTransaction.java [deleted file]
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/ForwardingDOMTransactionChain.java

index d3cc89d44a10177d7848c410e4d423017b0c0922..3a03ebc18bd79a202d9c4f86d9377bc3219eb8c3 100644 (file)
@@ -28,12 +28,6 @@ public interface BindingTransactionChain extends TransactionFactory, Transaction
     @Override
     ReadOnlyTransaction newReadOnlyTransaction();
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    ReadWriteTransaction newReadWriteTransaction();
-
     /**
      * {@inheritDoc}
      */
index d47e12eac3397faff4b7c975a171e8fcecf3e729..a5e9c8562d39b026f887b6ebc078245e0e90a9b2 100644 (file)
@@ -33,12 +33,6 @@ public interface DataBroker extends  AsyncDataBroker<InstanceIdentifier<?>, Data
     @Override
     ReadOnlyTransaction newReadOnlyTransaction();
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    ReadWriteTransaction newReadWriteTransaction();
-
     /**
      * {@inheritDoc}
      */
index ffde9ce823aebc969329175ab64c9b61e8a878bf..eb572dd27627809e1e891e769e224fab76807043 100644 (file)
@@ -8,16 +8,44 @@
 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);
 }
diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/ReadTransaction.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/ReadTransaction.java
deleted file mode 100644 (file)
index c9d9c06..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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);
-}
diff --git a/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/ReadWriteTransaction.java b/binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/ReadWriteTransaction.java
deleted file mode 100644 (file)
index a617d55..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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> {
-
-}
index 96819c45e250021ac6508e10619d9b2d119e39ba..304cab6e46af5b1f0756e5a2788d7584c906ba16 100644 (file)
@@ -18,9 +18,6 @@ public interface TransactionFactory extends AsyncDataTransactionFactory<Instance
     @Override
     ReadOnlyTransaction newReadOnlyTransaction();
 
-    @Override
-    ReadWriteTransaction newReadWriteTransaction();
-
     @Override
     WriteTransaction newWriteOnlyTransaction();
 
diff --git a/binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/AbstractReadWriteTransaction.java b/binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/AbstractReadWriteTransaction.java
deleted file mode 100644 (file)
index c106aff..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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);
-    }
-
-}
index 80926af01afb9c4d1540557ce0f420d8a8675524..ed4bb01530668d7da5a5d2a0ed83eede072321ba 100644 (file)
@@ -19,7 +19,6 @@ import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
 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;
@@ -62,16 +61,10 @@ public class BindingDOMDataBrokerAdapter extends AbstractForwardedDataBroker imp
     }
 
     @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());
diff --git a/binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/BindingDOMReadWriteTransactionAdapter.java b/binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/BindingDOMReadWriteTransactionAdapter.java
deleted file mode 100644 (file)
index 0c97975..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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
index 4e2a8e86532eaa02fa9293c7d255d949566da177..469d3fe22129deacc2494b3f4d18e4baa24af300 100644 (file)
@@ -14,12 +14,10 @@ import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
 
 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;
@@ -58,19 +56,6 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
         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();
index cc9dea205a3b4a7def4b771fdd02a1664e3a342b..8c7aada929938af5c1b8583579348d63d3bed4d9 100644 (file)
@@ -18,10 +18,11 @@ import static org.opendaylight.mdsal.binding.test.model.util.ListsBindingUtils.p
 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;
@@ -46,14 +47,14 @@ public class Bug1333DataChangeListenerTest extends AbstractDataChangeListenerTes
             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());
     }
index d1017cd807a64fe78ba1731c74251db9396a2a47..6c7146552ebb9acf1970fa88ed724f88d18e812e 100644 (file)
@@ -18,7 +18,7 @@ import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATI
 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;
@@ -56,7 +56,7 @@ public class ListInsertionDataChangeListenerTest extends AbstractDataChangeListe
         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();
@@ -111,7 +111,7 @@ public class ListInsertionDataChangeListenerTest extends AbstractDataChangeListe
         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());
 
@@ -125,7 +125,7 @@ public class ListInsertionDataChangeListenerTest extends AbstractDataChangeListe
         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());
 
@@ -139,7 +139,7 @@ public class ListInsertionDataChangeListenerTest extends AbstractDataChangeListe
         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());
 
index efd227c57ccd0b72ec5a9bba6fc42f7f36d18c2b..87758ec2d0e5ff193131aa9589a594b8379c13c5 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.yangtools.concepts.Path;
  * <ul>
  * <li>Read-Only - allocated using {@link #newReadOnlyTransaction()}
  * <li>Write-Only - allocated using {@link #newWriteOnlyTransaction()}
- * <li>Read-Write - allocated using {@link #newReadWriteTransaction()}
  * </ul>
  *
  * <p>
@@ -29,8 +28,8 @@ import org.opendaylight.yangtools.concepts.Path;
  *
  * <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>
@@ -47,7 +46,7 @@ import org.opendaylight.yangtools.concepts.Path;
  * @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> {
 
     /**
@@ -123,19 +122,14 @@ public interface AsyncDataBroker<P extends Path<P>, D, L extends AsyncDataChange
      * {@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
index d48296057e64f8822758ac80f6e256bf088b55a9..c9e811cdf153e8ebf8733087dcd117ae4a000251 100644 (file)
@@ -25,7 +25,6 @@ import org.opendaylight.yangtools.concepts.Path;
  * <ul>
  * <li>Read-Only - allocated using {@link #newReadOnlyTransaction()}
  * <li>Write-Only - allocated using {@link #newWriteOnlyTransaction()}
- * <li>Read-Write - allocated using {@link #newReadWriteTransaction()}
  * </ul>
  *
  * <p>
@@ -34,8 +33,8 @@ import org.opendaylight.yangtools.concepts.Path;
  *
  * <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
@@ -66,19 +65,6 @@ public interface AsyncDataTransactionFactory<P extends Path<P>, D> {
      */
     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.
      *
diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncReadWriteTransaction.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncReadWriteTransaction.java
deleted file mode 100644 (file)
index 347320f..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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> {
-
-}
index 261f422fff702b7aa334fd6ad824084d31f8dc77..9d11778c7b271a94b63810213428fe7f879cd66e 100644 (file)
@@ -19,7 +19,6 @@ import org.opendaylight.yangtools.concepts.Path;
  * <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
@@ -28,11 +27,10 @@ import org.opendaylight.yangtools.concepts.Path;
  * @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();
 
 
 }
index 8eb2e9c0d5b9951bf6bd4a22fb5c3d196331b9ea..242d2ecebe2cc65ab977bed5a532ce438492b4ff 100644 (file)
@@ -66,33 +66,6 @@ public interface TransactionChain<P extends Path<P>, D> extends AutoCloseable,
     @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.
      *
index 9d76f15e7e21d3d61674f2f6a538c7f1fefcf60b..77824b9c79263565ee6a9ae50166da7ecfd57d01 100644 (file)
@@ -34,12 +34,6 @@ public interface DOMDataBroker extends
     @Override
     DOMDataReadOnlyTransaction newReadOnlyTransaction();
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    DOMDataReadWriteTransaction newReadWriteTransaction();
-
     /**
      * {@inheritDoc}
      */
diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataReadWriteTransaction.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataReadWriteTransaction.java
deleted file mode 100644 (file)
index 4935920..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * 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<?, ?>> {
-
-}
index 502924e6929de2f4948e1eb7c54be2c3bbb3c41e..85115bf10d305cdd4c7eb96ac4c8bbd9f12a119f 100644 (file)
@@ -27,9 +27,6 @@ public interface DOMTransactionChain extends TransactionChain<YangInstanceIdenti
     @Override
     DOMDataReadOnlyTransaction newReadOnlyTransaction();
 
-    @Override
-    DOMDataReadWriteTransaction newReadWriteTransaction();
-
     @Override
     DOMDataWriteTransaction newWriteOnlyTransaction();
 
index 72a255daa19217c7d847078403bda106feab0818..35aaf8d6753c0bc80802ea9412784385f135e723 100644 (file)
@@ -17,7 +17,6 @@ import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 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;
@@ -147,51 +146,6 @@ abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransact
         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.
diff --git a/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/DOMForwardedReadWriteTransaction.java b/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/DOMForwardedReadWriteTransaction.java
deleted file mode 100644 (file)
index f46091e..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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);
-    }
-}
diff --git a/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongDataBroker.java b/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongDataBroker.java
deleted file mode 100644 (file)
index a1ad050..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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");
-    }
-}
diff --git a/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongFuture.java b/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongFuture.java
deleted file mode 100644 (file)
index 38878df..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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());
-    }
-  }
-}
-
diff --git a/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongTransaction.java b/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongTransaction.java
deleted file mode 100644 (file)
index e378795..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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
diff --git a/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongTransactionChain.java b/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/PingPongTransactionChain.java
deleted file mode 100644 (file)
index d97d6d0..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * 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();
-    }
-}
diff --git a/dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/test/DOMBrokerPerformanceTest.java b/dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/test/DOMBrokerPerformanceTest.java
deleted file mode 100644 (file)
index aa3af55..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * 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;
-            }
-        });
-    }
-}
index 4b37487e4cfd09858a12b0d4ac53c58156a17007..83648ece74bebe050cc61e439f94ccf69350e78a 100644 (file)
@@ -28,7 +28,6 @@ import org.opendaylight.mdsal.dom.broker.AbstractDOMDataBroker;
 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;
@@ -108,7 +107,7 @@ public class DOMBrokerTest {
         DOMDataReadTransaction readTx = domBroker.newReadOnlyTransaction();
         assertNotNull(readTx);
 
-        DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
+        DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
         assertNotNull(writeTx);
         /**
          *
@@ -117,14 +116,6 @@ public class DOMBrokerTest {
          */
         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());
 
         /**
          *
@@ -139,7 +130,7 @@ public class DOMBrokerTest {
     @Test(timeout=10000)
     public void testTransactionCommit() throws InterruptedException, ExecutionException {
 
-        DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
+        DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
         assertNotNull(writeTx);
         /**
          *
@@ -148,15 +139,6 @@ public class DOMBrokerTest {
          */
         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()
@@ -176,7 +158,7 @@ public class DOMBrokerTest {
         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 );
index 32db3b5250baa5c18adb151ab9ec6e2a5b4cfb56..dc1fc636b2f24a799e095b8f62d4f5d6ad8d1137 100644 (file)
@@ -14,24 +14,26 @@ import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATI
 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;
@@ -72,7 +74,7 @@ public class DOMTransactionChainTest {
          *
          *
          */
-        DOMDataReadWriteTransaction firstTx = allocateAndWrite(txChain);
+        DOMDataWriteTransaction firstTx = allocateAndWrite(txChain);
 
         /**
          * First transaction is marked as ready, we are able to allocate chained
@@ -100,7 +102,7 @@ public class DOMTransactionChainTest {
          * is read-write.
          *
          */
-        DOMDataReadWriteTransaction thirdDeleteTx = allocateAndDelete(txChain);
+        DOMDataWriteTransaction thirdDeleteTx = allocateAndDelete(txChain);
 
         /**
          * We commit first transaction
@@ -161,17 +163,9 @@ public class DOMTransactionChainTest {
         }
     }
 
-    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
          */
@@ -179,10 +173,10 @@ public class DOMTransactionChainTest {
         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;
     }
 
@@ -198,9 +192,8 @@ public class DOMTransactionChainTest {
         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);
     }
 }
index efe092003fd6570d4c5738ce4c2ef6d11bfb3f04..8178ccc52c29cd39b6529fe6a8f3ac2124a9e4ec 100644 (file)
@@ -14,7 +14,6 @@ import org.opendaylight.mdsal.dom.api.DOMDataBroker;
 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;
@@ -43,11 +42,6 @@ public abstract class ForwardingDOMDataBroker extends ForwardingObject implement
         return delegate().newReadOnlyTransaction();
     }
 
-    @Override
-    public DOMDataReadWriteTransaction newReadWriteTransaction() {
-        return delegate().newReadWriteTransaction();
-    }
-
     @Override
     public DOMDataWriteTransaction newWriteOnlyTransaction() {
         return delegate().newWriteOnlyTransaction();
diff --git a/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/ForwardingDOMDataReadWriteTransaction.java b/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/ForwardingDOMDataReadWriteTransaction.java
deleted file mode 100644 (file)
index 2167e04..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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();
-    }
-
-}
index e117353827eeadc008251b7beba85f900f043e8e..6d2d5bf50922550c1766bdb50ecf33db35e30a7a 100644 (file)
@@ -8,7 +8,6 @@
 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;
 
@@ -33,11 +32,6 @@ public abstract class ForwardingDOMTransactionChain extends ForwardingObject imp
         return delegate().newReadOnlyTransaction();
     }
 
-    @Override
-    public DOMDataReadWriteTransaction newReadWriteTransaction() {
-        return delegate().newReadWriteTransaction();
-    }
-
     @Override
     public DOMDataWriteTransaction newWriteOnlyTransaction() {
         return delegate().newWriteOnlyTransaction();