*/
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.
*
* <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
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
*
* @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>
* MyDataObject data = ...;
* InstanceIdentifier<MyDataObject> path = ...;
* writeTx.put(LogicalDatastoreType.OPERATIONAL, path, data);
- * Futures.addCallback(writeTx.submit(), new FutureCallback<Void>() {
- * public void onSuccess(Void result) {
+ * Futures.addCallback(writeTx.commit(), new FutureCallback<CommitInfo>() {
+ * public void onSuccess(CommitInfo result) {
* // succeeded
* }
* public void onFailure(Throwable t) {
* <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
*
* <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>
*
* <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>
* 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
* 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>
* @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);
- }
- };
}
* 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
* <pre><code>
* AsyncWriteTransaction t1 = broker.newWriteOnlyTransaction();
* t1.put(id, data);
- * t1.submit();
+ * t1.commit();
*
* AsyncReadTransaction t2 = broker.newReadOnlyTransaction();
* Optional<?> maybeData = t2.read(id).get();
*
* <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>
*
* <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>
* 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.
*
* <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>
* 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.