Remove AsyncWriteTransaction#submit 28/72628/4
authorTom Pantelis <tompantelis@gmail.com>
Sun, 3 Jun 2018 18:43:17 +0000 (14:43 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Mon, 4 Jun 2018 22:15:31 +0000 (18:15 -0400)
Change-Id: I0fd4babc5c9754d524653979f5d6ada4198cbe6a
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
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
common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncWriteTransaction.java
common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionChain.java

index 86f201008ab87a7cfe2344f01444404556af2c6f..388d7fddc92c620d2b6853f75c4501725a13655c 100644 (file)
@@ -28,7 +28,7 @@ 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}
- * and {@link AsyncWriteTransaction#submit()}.
+ * and {@link AsyncWriteTransaction#commit()}.
  *
  *
  * <p>
index be0df369fdc4ef25c0eac2016cb334a3d457cec4..fe32c11a5365bcb6611021327fc2a1f4dff647c8 100644 (file)
@@ -35,7 +35,7 @@ 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}
- * and {@link AsyncWriteTransaction#submit()}.
+ * and {@link AsyncWriteTransaction#commit()}.
  *
  * <p>
  * It is strongly recommended to use the type of transaction, which provides only the minimal
@@ -74,13 +74,13 @@ public interface AsyncDataTransactionFactory<P extends Path<P>, D> {
      * <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()}
+     * way then the commit of this transaction will fail. See {@link AsyncWriteTransaction#commit()}
      * for more details about conflicting and not-conflicting changes and failure scenarios.
      *
      * <p>
      * Since this transaction does not provide a view of the data it SHOULD BE used only by callers
      * which are exclusive writers (exporters of data) to the subtree they modify. This prevents
-     * optimistic lock failures as described in {@link AsyncWriteTransaction#submit()}.
+     * optimistic lock failures as described in {@link AsyncWriteTransaction#commit()}.
      *
      * <p>
      * Exclusivity of writers to particular subtree SHOULD BE enforced by external locking
@@ -96,7 +96,7 @@ public interface AsyncDataTransactionFactory<P extends Path<P>, D> {
      * <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
+     * will fail. See {@link AsyncWriteTransaction#commit()} for more details about conflicting and not-conflicting
      * changes and failure scenarios.
      *
      * @return new read-write transaction
index 068b57063688156facbadd43a500db82c13c0d81..37c717235b96cd8e88e9ca90fce448f8717e5ea6 100644 (file)
@@ -24,14 +24,14 @@ import org.opendaylight.yangtools.concepts.Path;
  * transactions.
  *
  * <p>
- * Applications publish the changes proposed in the transaction by calling {@link #submit}
+ * Applications publish the changes proposed in the transaction by calling {@link #commit}
  * on the transaction. This seals the transaction
- * (preventing any further writes using this transaction) and submits it to be
+ * (preventing any further writes using this transaction) and commits 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.
+ * an incompatible way. See {@link #commit()} 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.
index ac0d137e07952d4282d031b1dd6c609c4a30836f..b448b5978ebc32c3cd0c51f81387bc351eb2689c 100644 (file)
@@ -7,14 +7,11 @@
  */
 package org.opendaylight.mdsal.common.api;
 
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.MoreExecutors;
 import javax.annotation.CheckReturnValue;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Path;
-import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
 
 /**
  * Write transaction provides mutation capabilities for a data tree.
@@ -76,13 +73,13 @@ import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
  *
  * <p>
  * After applying changes to the local data tree, 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
+ * transaction by calling {@link #commit} on the transaction. This seals the transaction
+ * (preventing any further writes using this transaction) and commits 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.
+ * an incompatible way. See {@link #commit} for more concrete commit failure examples.
  *
  * <p>
  * <b>Implementation Note:</b> This interface is not intended to be implemented
@@ -97,10 +94,10 @@ import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
 public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransaction<P, D> {
     /**
      * Cancels the transaction.
-     * Transactions can only be cancelled if it was not yet submited.
+     * Transactions can only be cancelled if it was not yet committed.
      * Invoking cancel() on failed or already canceled will have no effect, and transaction is
      * considered cancelled.
-     * Invoking cancel() on finished transaction (future returned by {@link #submit()} already
+     * Invoking cancel() on finished transaction (future returned by {@link #commit()} already
      * successfully completed) will always fail (return false).
      *
      * @return <tt>false</tt> if the task could not be cancelled, typically because it has already
@@ -115,37 +112,19 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      *
      * @param store Logical data store which should be modified
      * @param path Data object path
-     * @throws IllegalStateException if the transaction was submitted or canceled.
+     * @throws IllegalStateException if the transaction was committed or canceled.
      */
     void delete(LogicalDatastoreType store, P path);
 
     /**
-     * Submits this transaction to be asynchronously applied to update the logical data tree. The
-     * returned CheckedFuture conveys the result of applying the data changes.
-     *
-     * @return a CheckFuture containing the result of the commit. The Future blocks until the commit
-     *         operation is complete. A successful commit returns nothing. On failure, the Future
-     *         will fail with a {@link TransactionCommitFailedException} or an exception derived
-     *         from TransactionCommitFailedException.
-     * @throws IllegalStateException if the transaction is already submitted or was canceled.
-     * @deprecated Use {@link #commit()} instead.
-     */
-    @Deprecated
-    @CheckReturnValue
-    default CheckedFuture<Void, TransactionCommitFailedException> submit() {
-        return MappingCheckedFuture.create(commit().transform(ignored -> null, MoreExecutors.directExecutor()),
-                SUBMIT_EXCEPTION_MAPPER);
-    }
-
-    /**
-     * Submits this transaction to be asynchronously applied to update the logical data tree. The returned
+     * Commits this transaction to be asynchronously applied to update the logical data tree. The returned
      * {@link FluentFuture} conveys the result of applying the data changes.
      *
      * <p>
      * This call logically seals the transaction, which prevents the client from further changing the data tree using
      * this transaction. Any subsequent calls to <code>put(LogicalDatastoreType, Path, Object)</code>,
      * <code>merge(LogicalDatastoreType, Path, Object)</code>, <code>delete(LogicalDatastoreType, Path)</code> will fail
-     * with {@link IllegalStateException}. The transaction is marked as submitted and enqueued into the data store
+     * with {@link IllegalStateException}. The transaction is marked as committed and enqueued into the data store
      * back-end for processing.
      *
      * <p>
@@ -164,8 +143,8 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      *      MyDataObject data = ...;
      *      InstanceIdentifier&lt;MyDataObject&gt; path = ...;
      *      writeTx.put(LogicalDatastoreType.OPERATIONAL, path, data);
-     *      Futures.addCallback(writeTx.submit(), new FutureCallback&lt;Void&gt;() {
-     *          public void onSuccess(Void result) {
+     *      Futures.addCallback(writeTx.commit(), new FutureCallback&lt;CommitInfo&gt;() {
+     *          public void onSuccess(CommitInfo result) {
      *              // succeeded
      *          }
      *          public void onFailure(Throwable t) {
@@ -193,7 +172,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      *   <li>
      *     Another transaction finished earlier and modified the same node in a non-compatible way (see below). In this
      *     case the returned future will fail with an {@link OptimisticLockFailedException}. It is the responsibility
-     *     of the caller to create a new transaction and submit the same modification again in order to update data
+     *     of the caller to create a new transaction and commit the same modification again in order to update data
      *     tree.
      *     <i>
      *       <b>Warning</b>: In most cases, retrying after an OptimisticLockFailedException will result in a high
@@ -214,7 +193,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      *
      * <h4>Change compatibility of leafs, leaf-list items</h4>
      * Following table shows state changes and failures between two concurrent transactions, which are based on same
-     * initial state, Tx 1 completes successfully before Tx 2 is submitted.
+     * initial state, Tx 1 completes successfully before Tx 2 is committed.
      *
      * <table summary="Change compatibility of leaf values">
      * <tr>
@@ -291,7 +270,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      *
      * <h4>Change compatibility of subtrees</h4>
      * Following table shows state changes and failures between two concurrent transactions, which are based on same
-     * initial state, Tx 1 completes successfully before Tx 2 is submitted.
+     * initial state, Tx 1 completes successfully before Tx 2 is committed.
      *
      * <table summary="Change compatibility of containers">
      * <tr>
@@ -464,8 +443,8 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * txB = broker.newWriteTransaction(); // allocates new transaction, data tree is empty
      * txA.put(CONFIGURATION, PATH, A);    // writes to PATH value A
      * txB.put(CONFIGURATION, PATH, B)     // writes to PATH value B
-     * ListenableFuture futureA = txA.submit(); // transaction A is sealed and submitted
-     * ListenebleFuture futureB = txB.submit(); // transaction B is sealed and submitted
+     * ListenableFuture futureA = txA.commit(); // transaction A is sealed and committed
+     * ListenebleFuture futureB = txB.commit(); // transaction B is sealed and committed
      * </pre>
      * Commit of transaction A will be processed asynchronously and data tree will be updated to
      * contain value <code>A</code> for <code>PATH</code>. Returned {@link ListenableFuture} will
@@ -473,7 +452,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * Commit of Transaction B will fail, because previous transaction also modified path in a
      * concurrent way. The state introduced by transaction B will not be applied. Returned
      * {@link ListenableFuture} object will fail with {@link OptimisticLockFailedException}
-     * exception, which indicates to client that concurrent transaction prevented the submitted
+     * exception, which indicates to client that concurrent transaction prevented the committed
      * transaction from being applied. <br>
      *
      * <p>
@@ -484,20 +463,8 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * @return a FluentFuture containing the result of the commit information. The Future blocks until the commit
      *         operation is complete. A successful commit returns nothing. On failure, the Future will fail with a
      *         {@link TransactionCommitFailedException} or an exception derived from TransactionCommitFailedException.
-     * @throws IllegalStateException if the transaction is already submitted or was canceled.
+     * @throws IllegalStateException if the transaction is already committed or was canceled.
      */
     @CheckReturnValue
     @NonNull FluentFuture<? extends @NonNull CommitInfo> commit();
-
-    /**
-     * This only exists for reuse by the deprecated {@link #submit} method and is not intended for general use.
-     */
-    @Deprecated
-    ExceptionMapper<TransactionCommitFailedException> SUBMIT_EXCEPTION_MAPPER =
-        new ExceptionMapper<TransactionCommitFailedException>("submit", TransactionCommitFailedException.class) {
-            @Override
-            protected TransactionCommitFailedException newWithCause(String message, Throwable cause) {
-                return new TransactionCommitFailedException(message, cause);
-            }
-        };
 }
index addddca11f1f3e2d25a196f3ff05ef2f5c8c245f..d68edc13fc4fcfc46e5772f15d006544a44a2f74 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.yangtools.concepts.Path;
  * A chain of transactions. Transactions in a chain need to be committed in
  * sequence and each transaction should see the effects of previous committed transactions
  * as they occurred. A chain makes no guarantees of atomicity across the chained transactions -
- * the transactions are committed as soon as possible in the order that they were submitted.
+ * the transactions are committed as soon as possible in the order that they were committed.
  * This behaviour is different from the default AsyncDataBroker, where a
  * transaction is always created from the current global state, not taking into
  * account any transactions previously committed by the calling thread. Due to
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.concepts.Path;
  * <pre><code>
  * AsyncWriteTransaction t1 = broker.newWriteOnlyTransaction();
  * t1.put(id, data);
- * t1.submit();
+ * t1.commit();
  *
  * AsyncReadTransaction t2 = broker.newReadOnlyTransaction();
  * Optional&lt;?&gt; maybeData = t2.read(id).get();
@@ -45,7 +45,7 @@ public interface TransactionChain<P extends Path<P>, D> extends AutoCloseable,
      *
      * <p>
      * The previous write transaction has to be either SUBMITTED
-     * ({@link AsyncWriteTransaction#submit submit} was invoked) or CANCELLED
+     * ({@link AsyncWriteTransaction#commit commit} was invoked) or CANCELLED
      * ({@link #close close} was invoked).
      *
      * <p>
@@ -69,7 +69,7 @@ public interface TransactionChain<P extends Path<P>, D> extends AutoCloseable,
      *
      * <p>
      * The previous write transaction has to be either SUBMITTED
-     * ({@link AsyncWriteTransaction#submit submit} was invoked) or CANCELLED
+     * ({@link AsyncWriteTransaction#commit commit} was invoked) or CANCELLED
      * ({@link #close close} was invoked)
      *
      * <p>
@@ -80,8 +80,8 @@ public interface TransactionChain<P extends Path<P>, D> extends AutoCloseable,
      * the previous transaction is not visible
      *
      * <p>
-     * Committing this write-only transaction using {@link AsyncWriteTransaction#submit submit}
-     * will submit the state changes in this transaction to be visible to any subsequent
+     * Committing this write-only transaction using {@link AsyncWriteTransaction#commit commit}
+     * will commit 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.
@@ -98,7 +98,7 @@ public interface TransactionChain<P extends Path<P>, D> extends AutoCloseable,
      *
      * <p>
      * The previous write transaction has to be either SUBMITTED
-     * ({@link AsyncWriteTransaction#submit submit} was invoked) or CANCELLED
+     * ({@link AsyncWriteTransaction#commit commit} was invoked) or CANCELLED
      * ({@link #close close} was invoked).
      *
      * <p>
@@ -109,8 +109,8 @@ public interface TransactionChain<P extends Path<P>, D> extends AutoCloseable,
      * 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
+     * Committing this read-write transaction using {@link AsyncWriteTransaction#commit commit}
+     * will commit 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.