X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-common-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fcommon%2Fapi%2Fdata%2FAsyncWriteTransaction.java;fp=opendaylight%2Fmd-sal%2Fsal-common-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fcommon%2Fapi%2Fdata%2FAsyncWriteTransaction.java;h=79f80a3f0577e1ce2fd28486497652a982ee7381;hp=51bb1db40bdcb078b77b1a970f256f23b28742b2;hb=84d6864d26fddddd92da32fd00d57c7224d4213d;hpb=971a5efd2c7721e23c50ebef115419649c6a44a9 diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java index 51bb1db40b..79f80a3f05 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java @@ -8,7 +8,12 @@ package org.opendaylight.controller.md.sal.common.api.data; 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.mdsal.common.api.CommitInfo; import org.opendaylight.yangtools.concepts.Path; /** @@ -330,6 +335,43 @@ public interface AsyncWriteTransaction

, D> extends AsyncTransa * * @throws IllegalStateException * if the transaction is not new + * @deprecated Use {@link #commit()} instead. */ + @Deprecated CheckedFuture submit(); + + /** + * Submits this transaction to be asynchronously applied to update the logical data tree. The returned + * {@link FluentFuture} conveys the result of applying the data changes. + * + *

+ * This call logically seals the transaction, which prevents the client from further changing the data tree using + * this transaction. Any subsequent calls to put(LogicalDatastoreType, Path, Object), + * merge(LogicalDatastoreType, Path, Object), delete(LogicalDatastoreType, Path) will fail + * with {@link IllegalStateException}. The transaction is marked as submitted and enqueued into the data store + * back-end for processing. + * + *

+ * Whether or not the commit is successful is determined by versioning of the data tree and validation of registered + * commit participants if the transaction changes the data tree. + * + *

+ * The effects of a successful commit of data depends on listeners and commit participants that are registered with + * the data broker. + * + *

+ * A successful commit produces implementation-specific {@link CommitInfo} structure, which is used to communicate + * post-condition information to the caller. Such information can contain commit-id, timing information or any + * other information the implementation wishes to share. + * + * @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 committed or was canceled. + */ + @CheckReturnValue + default @NonNull FluentFuture commit() { + return FluentFuture.from(submit()).transformAsync(ignored -> CommitInfo.emptyFluentFuture(), + MoreExecutors.directExecutor()); + } }