Add AsyncWriteTransaction.commit() 16/71516/5
authorTom Pantelis <tompantelis@gmail.com>
Fri, 27 Apr 2018 15:23:00 +0000 (11:23 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Sat, 28 Apr 2018 00:43:36 +0000 (20:43 -0400)
Equivalent to the recent md-sal API addition. The CommitInfo class
is re-used from md-sal. I also modified all implementations in the
controller to implement commit even though it's defaulted. As soon
as implementations in other projects do the same then we can
default submit().

Change-Id: I0801d5aa4c197177af838e7fbb71b7766a90e043
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
32 files changed:
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/AbstractTracingWriteTransaction.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/TracingReadWriteTransaction.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/TracingWriteTransaction.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/ForwardingReadWriteTransaction.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/ForwardingWriteTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractWriteTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMTransactionChainAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMWriteTransactionAdapter.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java
opendaylight/md-sal/sal-common-api/pom.xml
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/AbstractDOMTransactionFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBroker.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/DOMBrokerTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/compat/LegacyDOMDataBrokerAdapter.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerWriteTransactionTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBrokerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/compat/LegacyDOMDataBrokerAdapterTest.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMForwardedTransactionFactory.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/CommitCoordinationTask.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataBrokerTransactionChainImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongFuture.java [deleted file]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransactionChain.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/SerializedDOMDataBroker.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingReadWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedWriteTransactionTest.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMDataReadWriteTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMDataWriteTransaction.java

index 9cc67ba..f7dd4d7 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.md.sal.trace.dom.impl;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -16,6 +17,7 @@ import java.util.Set;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -100,6 +102,12 @@ abstract class AbstractTracingWriteTransaction implements DOMDataWriteTransactio
         return delegate.submit();
     }
 
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        logOps();
+        return delegate.commit();
+    }
+
     @Override
     public Object getIdentifier() {
         return delegate.getIdentifier();
index 31287b0..6fbe58b 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.md.sal.trace.dom.impl;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import java.util.Objects;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -17,6 +18,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTracked;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedRegistry;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedTrait;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -51,6 +53,12 @@ class TracingReadWriteTransaction
         return super.submit();
     }
 
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        closeTracker.removeFromTrackedRegistry();
+        return super.commit();
+    }
+
     @Override
     public boolean cancel() {
         closeTracker.removeFromTrackedRegistry();
index 18c6117..4d33a46 100644 (file)
@@ -8,11 +8,13 @@
 package org.opendaylight.controller.md.sal.trace.dom.impl;
 
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTracked;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedRegistry;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedTrait;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 
 class TracingWriteTransaction extends AbstractTracingWriteTransaction
         implements CloseTracked<TracingWriteTransaction> {
@@ -31,6 +33,12 @@ class TracingWriteTransaction extends AbstractTracingWriteTransaction
         return super.submit();
     }
 
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        closeTracker.removeFromTrackedRegistry();
+        return super.commit();
+    }
+
     @Override
     public boolean cancel() {
         closeTracker.removeFromTrackedRegistry();
index 756ed96..a21268d 100644 (file)
@@ -10,9 +10,11 @@ package org.opendaylight.controller.md.sal.binding.api;
 import com.google.common.base.Optional;
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
@@ -77,6 +79,11 @@ public class ForwardingReadWriteTransaction extends ForwardingObject implements
         return delegate.submit();
     }
 
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        return delegate.commit();
+    }
+
     @Override
     public void delete(LogicalDatastoreType store, InstanceIdentifier<?> path) {
         delegate.delete(store, path);
index 8c10c6f..801732d 100644 (file)
@@ -9,8 +9,10 @@ package org.opendaylight.controller.md.sal.binding.api;
 
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
@@ -69,6 +71,11 @@ public class ForwardingWriteTransaction extends ForwardingObject implements Writ
         return delegate.submit();
     }
 
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        return delegate.commit();
+    }
+
     @Override
     public Object getIdentifier() {
         return delegate.getIdentifier();
index eebd836..bb9c98e 100644 (file)
@@ -9,11 +9,11 @@ package org.opendaylight.controller.md.sal.binding.impl;
 
 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.FluentFuture;
 import java.util.Map.Entry;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -125,8 +125,8 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
         getDelegate().delete(store, normalized);
     }
 
-    protected final CheckedFuture<Void,TransactionCommitFailedException> doSubmit() {
-        return getDelegate().submit();
+    protected final FluentFuture<? extends CommitInfo> doCommit() {
+        return getDelegate().commit();
     }
 
     protected final boolean doCancel() {
index 7955dcd..3358c9e 100644 (file)
@@ -8,9 +8,8 @@
 package org.opendaylight.controller.md.sal.binding.impl;
 
 import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
@@ -19,12 +18,12 @@ import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.concepts.Delegator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -64,8 +63,8 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
         return new BindingDOMReadWriteTransactionAdapter(delegateTx, codec) {
 
             @Override
-            public CheckedFuture<Void, TransactionCommitFailedException> submit() {
-                return listenForFailure(this,super.submit());
+            public FluentFuture<? extends CommitInfo> commit() {
+                return listenForFailure(this, super.commit());
             }
 
         };
@@ -77,23 +76,23 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
         return new BindingDOMWriteTransactionAdapter<DOMDataWriteTransaction>(delegateTx, codec) {
 
             @Override
-            public CheckedFuture<Void,TransactionCommitFailedException> submit() {
-                return listenForFailure(this,super.submit());
+            public FluentFuture<? extends CommitInfo> commit() {
+                return listenForFailure(this, super.commit());
             }
 
         };
     }
 
-    private CheckedFuture<Void, TransactionCommitFailedException> listenForFailure(
-            final WriteTransaction tx, final CheckedFuture<Void, TransactionCommitFailedException> future) {
-        Futures.addCallback(future, new FutureCallback<Void>() {
+    private FluentFuture<? extends CommitInfo> listenForFailure(
+            final WriteTransaction tx, final FluentFuture<? extends CommitInfo> future) {
+        future.addCallback(new FutureCallback<CommitInfo>() {
             @Override
             public void onFailure(final Throwable ex) {
                 failTransactionChain(tx,ex);
             }
 
             @Override
-            public void onSuccess(final Void result) {
+            public void onSuccess(final CommitInfo result) {
                 // Intentionally NOOP
             }
         }, MoreExecutors.directExecutor());
index c6c9c9f..142ad4a 100644 (file)
@@ -8,6 +8,8 @@
 package org.opendaylight.controller.md.sal.binding.impl;
 
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
@@ -16,6 +18,9 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFaile
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationOperation;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.md.sal.dom.broker.impl.TransactionCommitFailedExceptionMapper;
+import org.opendaylight.mdsal.common.api.CommitInfo;
+import org.opendaylight.mdsal.common.api.MappingCheckedFuture;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -68,7 +73,13 @@ class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> exten
 
     @Override
     public CheckedFuture<Void,TransactionCommitFailedException> submit() {
-        return doSubmit();
+        return MappingCheckedFuture.create(commit().transform(ignored -> null,
+                MoreExecutors.directExecutor()), TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER);
+    }
+
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        return doCommit();
     }
 
     @Override
index 74c0ade..314ee4b 100644 (file)
@@ -13,6 +13,7 @@ import static org.junit.Assert.assertTrue;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Collections;
@@ -38,6 +39,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
 import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.List11SimpleAugment;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.TllComplexAugment;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.aug.grouping.List1;
@@ -201,6 +203,10 @@ public class CrossBrokerMountPointTest {
                             throw new UnsupportedOperationException();
                         }
 
+                        @Override
+                        public FluentFuture<? extends CommitInfo> commit() {
+                            throw new UnsupportedOperationException();
+                        }
                     };
                 }
 
index 9d3e2b1..9c8a303 100644 (file)
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-data-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal</groupId>
+      <artifactId>mdsal-common-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
index 51bb1db..79f80a3 100644 (file)
@@ -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<P extends Path<P>, D> extends AsyncTransa
      *
      * @throws IllegalStateException
      *             if the transaction is not new
+     * @deprecated Use {@link #commit()} instead.
      */
+    @Deprecated
     CheckedFuture<Void,TransactionCommitFailedException> 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.
+     *
+     * <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
+     * back-end for processing.
+     *
+     * <p>
+     * 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.
+     *
+     * <p>
+     * The effects of a successful commit of data depends on listeners and commit participants that are registered with
+     * the data broker.
+     *
+     * <p>
+     * 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<? extends @NonNull CommitInfo> commit() {
+        return FluentFuture.from(submit()).transformAsync(ignored -> CommitInfo.emptyFluentFuture(),
+            MoreExecutors.directExecutor());
+    }
 }
index 2082ad2..c109165 100644 (file)
@@ -11,14 +11,18 @@ package org.opendaylight.controller.cluster.databroker;
 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.FluentFuture;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.MappingCheckedFuture;
 import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
 import org.opendaylight.mdsal.dom.broker.TransactionCommitFailedExceptionMapper;
@@ -125,24 +129,30 @@ public abstract class AbstractDOMBrokerWriteTransaction<T extends DOMStoreWriteT
     }
 
     @Override
-    @SuppressWarnings("checkstyle:illegalcatch")
     public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+        return MappingCheckedFuture.create(commit().transform(ignored -> null,
+                MoreExecutors.directExecutor()), TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER);
+    }
+
+    @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
+    public FluentFuture<? extends CommitInfo> commit() {
         final AbstractDOMTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
         checkRunning(impl);
 
         final Collection<T> txns = getSubtransactions();
         final Collection<DOMStoreThreePhaseCommitCohort> cohorts = new ArrayList<>(txns.size());
 
-        CheckedFuture<Void, TransactionCommitFailedException> ret;
+        FluentFuture<? extends CommitInfo> ret;
         try {
             for (final T txn : txns) {
                 cohorts.add(txn.ready());
             }
 
-            ret = impl.submit(this, cohorts);
+            ret = impl.commit(this, cohorts);
         } catch (RuntimeException e) {
-            ret = Futures.immediateFailedCheckedFuture(
-                    TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER.apply(e));
+            ret = FluentFuture.from(Futures.immediateFailedFuture(
+                    TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER.apply(e)));
         }
         FUTURE_UPDATER.lazySet(this, ret);
         return ret;
index f80ea94..91ca744 100644 (file)
@@ -9,13 +9,13 @@
 package org.opendaylight.controller.cluster.databroker;
 
 import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import java.util.Collection;
 import java.util.EnumMap;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
@@ -48,8 +48,8 @@ public abstract class AbstractDOMTransactionFactory<T extends DOMStoreTransactio
      * @param cohorts the associated cohorts
      * @return a resulting Future
      */
-    protected abstract CheckedFuture<Void,TransactionCommitFailedException> submit(
-            DOMDataTreeWriteTransaction transaction, Collection<DOMStoreThreePhaseCommitCohort> cohorts);
+    protected abstract FluentFuture<? extends CommitInfo> commit(DOMDataTreeWriteTransaction transaction,
+            Collection<DOMStoreThreePhaseCommitCohort> cohorts);
 
     /**
      * Creates a new read-only transaction.
index 043a26c..1199fbf 100644 (file)
@@ -14,7 +14,7 @@ import static org.opendaylight.mdsal.dom.broker.TransactionCommitFailedException
 import com.google.common.annotations.Beta;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.AbstractFuture;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -27,9 +27,9 @@ import java.util.Map;
 import java.util.concurrent.Executor;
 import org.opendaylight.controller.cluster.datastore.exceptions.NoShardLeaderException;
 import org.opendaylight.controller.cluster.datastore.exceptions.ShardLeaderNotRespondingException;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.DataStoreUnavailableException;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.MappingCheckedFuture;
 import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
 import org.opendaylight.mdsal.dom.broker.TransactionCommitFailedExceptionMapper;
@@ -77,7 +77,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker {
     }
 
     @Override
-    protected CheckedFuture<Void, TransactionCommitFailedException> submit(
+    protected FluentFuture<? extends CommitInfo> commit(
             final DOMDataTreeWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
 
         Preconditions.checkArgument(transaction != null, "Transaction must not be null.");
@@ -85,7 +85,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker {
         LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier());
 
         if (cohorts.isEmpty()) {
-            return Futures.immediateCheckedFuture(null);
+            return CommitInfo.emptyFluentFuture();
         }
 
         final AsyncNotifyingSettableFuture clientSubmitFuture =
@@ -93,7 +93,8 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker {
 
         doCanCommit(clientSubmitFuture, transaction, cohorts);
 
-        return MappingCheckedFuture.create(clientSubmitFuture, COMMIT_ERROR_MAPPER);
+        return FluentFuture.from(clientSubmitFuture).transform(ignored -> CommitInfo.empty(),
+                MoreExecutors.directExecutor());
     }
 
     private void doCanCommit(final AsyncNotifyingSettableFuture clientSubmitFuture,
index 2eabe79..2a0faee 100644 (file)
@@ -9,18 +9,17 @@
 package org.opendaylight.controller.cluster.databroker;
 
 import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.common.api.TransactionChainListener;
-import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
 import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort;
@@ -80,17 +79,17 @@ final class DOMBrokerTransactionChain extends AbstractDOMTransactionFactory<DOMS
     }
 
     @Override
-    public CheckedFuture<Void, TransactionCommitFailedException> submit(
+    public FluentFuture<? extends CommitInfo> commit(
             final DOMDataTreeWriteTransaction transaction, final Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
         checkNotFailed();
         checkNotClosed();
 
-        final CheckedFuture<Void, TransactionCommitFailedException> ret = broker.submit(transaction, cohorts);
+        final FluentFuture<? extends CommitInfo> ret = broker.commit(transaction, cohorts);
 
         COUNTER_UPDATER.incrementAndGet(this);
-        Futures.addCallback(ret, new FutureCallback<Void>() {
+        ret.addCallback(new FutureCallback<CommitInfo>() {
             @Override
-            public void onSuccess(final Void result) {
+            public void onSuccess(final CommitInfo result) {
                 transactionCompleted();
             }
 
index b3df0c3..d1a4078 100644 (file)
@@ -15,6 +15,7 @@ import com.google.common.collect.ForwardingObject;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.annotation.Nonnull;
@@ -40,6 +41,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeCommitCohortRegistr
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.MappingCheckedFuture;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistration;
@@ -300,6 +302,11 @@ public class LegacyDOMDataBrokerAdapter extends ForwardingObject implements DOMD
         public CheckedFuture<Void, TransactionCommitFailedException> submit() {
             return MappingCheckedFuture.create(writeDelegate().submit(), SUBMIT_EX_MAPPER);
         }
+
+        @Override
+        public FluentFuture<? extends CommitInfo> commit() {
+            return writeDelegate().commit();
+        }
     }
 
     private static class DOMDataReadOnlyTransactionAdapter implements DOMDataReadOnlyTransaction {
index 5263ab6..1ad1b34 100644 (file)
@@ -74,7 +74,7 @@ public class AbstractDOMBrokerWriteTransactionTest {
     @Test
     public void submitRuntimeExceptionAndCancel() {
         RuntimeException thrown = new RuntimeException();
-        doThrow(thrown).when(abstractDOMTransactionFactory).submit(any(), any());
+        doThrow(thrown).when(abstractDOMTransactionFactory).commit(any(), any());
         AbstractDOMBrokerWriteTransactionTestImpl abstractDOMBrokerWriteTransactionTestImpl
                 = new AbstractDOMBrokerWriteTransactionTestImpl();
 
index ca255c8..acf08eb 100644 (file)
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.verify;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -48,6 +49,7 @@ import org.mockito.InOrder;
 import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
 import org.opendaylight.controller.cluster.datastore.exceptions.NoShardLeaderException;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.DataStoreUnavailableException;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.common.api.TransactionChainListener;
@@ -61,6 +63,7 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
 import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
+import org.opendaylight.mdsal.dom.broker.TransactionCommitFailedExceptionMapper;
 import org.opendaylight.mdsal.dom.spi.store.DOMStore;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
@@ -135,13 +138,14 @@ public class ConcurrentDOMDataBrokerTest {
         doReturn(Futures.immediateFuture(null)).when(mockCohort2).preCommit();
         doReturn(Futures.immediateFuture(null)).when(mockCohort2).commit();
 
-        ListenableFuture<Void> future = coordinator.submit(transaction, Arrays.asList(mockCohort1, mockCohort2));
+        ListenableFuture<? extends CommitInfo> future =
+                coordinator.commit(transaction, Arrays.asList(mockCohort1, mockCohort2));
 
         final CountDownLatch doneLatch = new CountDownLatch(1);
         final AtomicReference<Throwable> caughtEx = new AtomicReference<>();
-        Futures.addCallback(future, new FutureCallback<Void>() {
+        Futures.addCallback(future, new FutureCallback<CommitInfo>() {
             @Override
-            public void onSuccess(final Void result) {
+            public void onSuccess(final CommitInfo result) {
                 doneLatch.countDown();
             }
 
@@ -184,21 +188,22 @@ public class ConcurrentDOMDataBrokerTest {
         doReturn(Futures.immediateFuture(false)).when(mockCohort3).canCommit();
         doReturn(Futures.immediateFuture(null)).when(mockCohort3).abort();
 
-        CheckedFuture<Void, TransactionCommitFailedException> future = coordinator.submit(
+        ListenableFuture<? extends CommitInfo> future = coordinator.commit(
                 transaction, Arrays.asList(mockCohort1, mockCohort2, mockCohort3));
 
         assertFailure(future, null, mockCohort1, mockCohort2, mockCohort3);
     }
 
-    private static void assertFailure(final CheckedFuture<Void, TransactionCommitFailedException> future,
+    private static void assertFailure(final ListenableFuture<?> future,
             final Exception expCause, final DOMStoreThreePhaseCommitCohort... mockCohorts)
                     throws Exception {
         try {
-            future.checkedGet(5, TimeUnit.SECONDS);
+            future.get(5, TimeUnit.SECONDS);
             fail("Expected TransactionCommitFailedException");
-        } catch (TransactionCommitFailedException e) {
+        } catch (ExecutionException e) {
+            TransactionCommitFailedException tcf = TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER.apply(e);
             if (expCause != null) {
-                assertSame("Expected cause", expCause.getClass(), e.getCause().getClass());
+                assertSame("Expected cause", expCause.getClass(), tcf.getCause().getClass());
             }
 
             InOrder inOrder = inOrder((Object[])mockCohorts);
@@ -219,7 +224,7 @@ public class ConcurrentDOMDataBrokerTest {
         doReturn(Futures.immediateFailedFuture(cause)).when(mockCohort2).canCommit();
         doReturn(Futures.immediateFuture(null)).when(mockCohort2).abort();
 
-        CheckedFuture<Void, TransactionCommitFailedException> future = coordinator.submit(
+        FluentFuture<? extends CommitInfo> future = coordinator.commit(
                 transaction, Arrays.asList(mockCohort1, mockCohort2));
 
         assertFailure(future, cause, mockCohort1, mockCohort2);
@@ -234,7 +239,7 @@ public class ConcurrentDOMDataBrokerTest {
         doReturn(Futures.immediateFailedFuture(rootCause)).when(mockCohort2).canCommit();
         doReturn(Futures.immediateFuture(null)).when(mockCohort2).abort();
 
-        CheckedFuture<Void, TransactionCommitFailedException> future = coordinator.submit(
+        FluentFuture<? extends CommitInfo> future = coordinator.commit(
             transaction, Arrays.asList(mockCohort1, mockCohort2));
 
         assertFailure(future, cause, mockCohort1, mockCohort2);
@@ -257,7 +262,7 @@ public class ConcurrentDOMDataBrokerTest {
                 .when(mockCohort3).preCommit();
         doReturn(Futures.immediateFuture(null)).when(mockCohort3).abort();
 
-        CheckedFuture<Void, TransactionCommitFailedException> future = coordinator.submit(
+        FluentFuture<? extends CommitInfo> future = coordinator.commit(
                 transaction, Arrays.asList(mockCohort1, mockCohort2, mockCohort3));
 
         assertFailure(future, cause, mockCohort1, mockCohort2, mockCohort3);
@@ -283,7 +288,7 @@ public class ConcurrentDOMDataBrokerTest {
                 .when(mockCohort3).commit();
         doReturn(Futures.immediateFuture(null)).when(mockCohort3).abort();
 
-        CheckedFuture<Void, TransactionCommitFailedException> future = coordinator.submit(
+        FluentFuture<? extends CommitInfo> future = coordinator.commit(
                 transaction, Arrays.asList(mockCohort1, mockCohort2, mockCohort3));
 
         assertFailure(future, cause, mockCohort1, mockCohort2, mockCohort3);
@@ -299,7 +304,7 @@ public class ConcurrentDOMDataBrokerTest {
         doReturn(Futures.immediateFailedFuture(cause)).when(mockCohort2).canCommit();
         doReturn(Futures.immediateFuture(null)).when(mockCohort2).abort();
 
-        CheckedFuture<Void, TransactionCommitFailedException> future = coordinator.submit(
+        FluentFuture<? extends CommitInfo> future = coordinator.commit(
                 transaction, Arrays.asList(mockCohort1, mockCohort2));
 
         assertFailure(future, cause, mockCohort1, mockCohort2);
@@ -443,11 +448,11 @@ public class ConcurrentDOMDataBrokerTest {
                 LogicalDatastoreType.OPERATIONAL, operationalDomStore, LogicalDatastoreType.CONFIGURATION,
                 configDomStore), futureExecutor) {
             @Override
-            public CheckedFuture<Void, TransactionCommitFailedException> submit(DOMDataTreeWriteTransaction writeTx,
+            public FluentFuture<? extends CommitInfo> commit(DOMDataTreeWriteTransaction writeTx,
                     Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
                 commitCohorts.addAll(cohorts);
                 latch.countDown();
-                return super.submit(writeTx, cohorts);
+                return super.commit(writeTx, cohorts);
             }
         }) {
             DOMDataTreeReadWriteTransaction domDataReadWriteTransaction = dataBroker.newReadWriteTransaction();
@@ -490,11 +495,11 @@ public class ConcurrentDOMDataBrokerTest {
                 configDomStore), futureExecutor) {
             @Override
             @SuppressWarnings("checkstyle:hiddenField")
-            public CheckedFuture<Void, TransactionCommitFailedException> submit(DOMDataTreeWriteTransaction writeTx,
+            public FluentFuture<? extends CommitInfo> commit(DOMDataTreeWriteTransaction writeTx,
                     Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
                 commitCohorts.addAll(cohorts);
                 latch.countDown();
-                return super.submit(writeTx, cohorts);
+                return super.commit(writeTx, cohorts);
             }
         }) {
             DOMDataTreeReadWriteTransaction domDataReadWriteTransaction = dataBroker.newReadWriteTransaction();
index f908792..b6e7682 100644 (file)
@@ -24,11 +24,13 @@ import static org.mockito.Mockito.verify;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.concurrent.TimeUnit;
+import org.eclipse.jdt.annotation.NonNull;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
@@ -57,6 +59,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeCommitCohortRegistr
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistration;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
@@ -452,6 +455,22 @@ public class LegacyDOMDataBrokerAdapterTest {
         verify(mockConfigStore).registerChangeListener(TestModel.TEST_PATH, listener, DataChangeScope.ONE);
     }
 
+    @Test
+    public void testCommit() throws Exception {
+        DOMDataWriteTransaction tx = adapter.newWriteOnlyTransaction();
+
+        tx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, dataNode);
+        verify(mockWriteTx).write(TestModel.TEST_PATH, dataNode);
+
+        @NonNull FluentFuture<? extends @NonNull CommitInfo> commitFuture = tx.commit();
+        commitFuture.get(5, TimeUnit.SECONDS);
+
+        InOrder inOrder = inOrder(mockCommitCohort);
+        inOrder.verify(mockCommitCohort).canCommit();
+        inOrder.verify(mockCommitCohort).preCommit();
+        inOrder.verify(mockCommitCohort).commit();
+    }
+
     private interface TestDOMStore extends DistributedDataStoreInterface, DOMStoreTreeChangePublisher,
             org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistry {
     }
index 4bb7197..e309996 100644 (file)
@@ -8,7 +8,8 @@
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
 import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.base.Supplier;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.Collection;
 import java.util.EnumMap;
 import java.util.Map;
@@ -64,26 +65,25 @@ abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransact
     protected abstract Object newTransactionIdentifier();
 
     /**
-     * User-supplied implementation of {@link DOMDataWriteTransaction#submit()}
+     * User-supplied implementation of {@link DOMDataWriteTransaction#commit()}
      * for transaction.
      *
      * <p>
-     * Callback invoked when {@link DOMDataWriteTransaction#submit()} is invoked
+     * Callback invoked when {@link DOMDataWriteTransaction#commit()} is invoked
      * on transaction created by this factory.
      *
      * @param transaction
-     *            Transaction on which {@link DOMDataWriteTransaction#submit()}
+     *            Transaction on which {@link DOMDataWriteTransaction#commit()}
      *            was invoked.
      * @param cohorts
      *            Iteratable of cohorts for subtransactions associated with
      *            the transaction being committed.
-     * @return a CheckedFuture. if commit coordination on cohorts finished successfully,
-     *         nothing is returned from the Future, On failure,
+     * @return a ListenableFuture. if commit coordination on cohorts finished successfully,
+     *         a CommitInfo is returned from the Future, On failure,
      *         the Future fails with a {@link TransactionCommitFailedException}.
      */
-    protected abstract CheckedFuture<Void,
-            TransactionCommitFailedException>
-                submit(DOMDataWriteTransaction transaction, Collection<DOMStoreThreePhaseCommitCohort> cohorts);
+    protected abstract <T> ListenableFuture<T> commit(DOMDataWriteTransaction transaction,
+            Collection<DOMStoreThreePhaseCommitCohort> cohorts, Supplier<T> futureValueSupplier);
 
     /**
      * Creates a new composite read-only transaction
@@ -142,11 +142,10 @@ abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransact
      * {@link DOMStoreWriteTransaction#delete(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)} is
      * invoked on
      * selected subtransaction.
-     * </li><li> {@link DOMDataWriteTransaction#submit()} - results in invoking
+     * </li><li> {@link DOMDataWriteTransaction#commit()} - 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.
+     * {@link #commit} with transaction which was commited and gathered results.
      * </li>
      * </ul>
      *
@@ -207,11 +206,10 @@ abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransact
      * {@link DOMStoreWriteTransaction#delete(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)} is
      * invoked on
      * selected subtransaction.
-     * <li> {@link DOMDataWriteTransaction#submit()} - results in invoking
+     * <li> {@link DOMDataWriteTransaction#commit()} - results in invoking
      * {@link DOMStoreWriteTransaction#ready()}, gathering all resulting cohorts
      * and then invoking finalized implementation callback
-     * {@link #submit(DOMDataWriteTransaction, Collection)} with transaction which
-     * was committed and gathered results.
+     * {@link #commit} with transaction which was committed and gathered results.
      * <li>
      * </ul>
      *
index 37f33aa..810f09a 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
 import com.google.common.base.Preconditions;
+import com.google.common.base.Supplier;
 import com.google.common.base.Throwables;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -26,7 +27,7 @@ import org.slf4j.LoggerFactory;
  * Implementation of blocking three-phase commit-coordination tasks without
  * support of cancellation.
  */
-final class CommitCoordinationTask implements Callable<Void> {
+final class CommitCoordinationTask<T> implements Callable<T> {
     private enum Phase {
         canCommit,
         preCommit,
@@ -37,17 +38,20 @@ final class CommitCoordinationTask implements Callable<Void> {
     private final Collection<DOMStoreThreePhaseCommitCohort> cohorts;
     private final DurationStatisticsTracker commitStatTracker;
     private final DOMDataWriteTransaction tx;
+    private final Supplier<T> futureValueSupplier;
 
     CommitCoordinationTask(final DOMDataWriteTransaction transaction,
             final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
-            final DurationStatisticsTracker commitStatTracker) {
+            final DurationStatisticsTracker commitStatTracker,
+            final Supplier<T> futureValueSupplier) {
         this.tx = Preconditions.checkNotNull(transaction, "transaction must not be null");
         this.cohorts = Preconditions.checkNotNull(cohorts, "cohorts must not be null");
         this.commitStatTracker = commitStatTracker;
+        this.futureValueSupplier = futureValueSupplier;
     }
 
     @Override
-    public Void call() throws TransactionCommitFailedException {
+    public T call() throws TransactionCommitFailedException {
         final long startTime = commitStatTracker != null ? System.nanoTime() : 0;
 
         Phase phase = Phase.canCommit;
@@ -65,7 +69,7 @@ final class CommitCoordinationTask implements Callable<Void> {
             commitBlocking();
 
             LOG.debug("Transaction {}: doCommit completed", tx.getIdentifier());
-            return null;
+            return futureValueSupplier.get();
         } catch (final TransactionCommitFailedException e) {
             LOG.warn("Tx: {} Error during phase {}, starting Abort", tx.getIdentifier(), phase, e);
             abortBlocking(e);
index c7eaef5..4c131e1 100755 (executable)
@@ -9,9 +9,11 @@
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
 import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.base.Supplier;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
@@ -19,7 +21,6 @@ import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
@@ -83,19 +84,17 @@ final class DOMDataBrokerTransactionChainImpl extends
     }
 
     @Override
-    public CheckedFuture<Void, TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
-                                                                        final
-                                                                        Collection<DOMStoreThreePhaseCommitCohort>
-                                                                                cohorts) {
+    public <T> ListenableFuture<T> commit(final DOMDataWriteTransaction transaction,
+            final Collection<DOMStoreThreePhaseCommitCohort> cohorts, final Supplier<T> futureValueSupplier) {
         checkNotFailed();
         checkNotClosed();
 
-        final CheckedFuture<Void, TransactionCommitFailedException> ret = broker.submit(transaction, cohorts);
+        final ListenableFuture<T> ret = broker.commit(transaction, cohorts, futureValueSupplier);
 
         COUNTER_UPDATER.incrementAndGet(this);
-        Futures.addCallback(ret, new FutureCallback<Void>() {
+        Futures.addCallback(ret, new FutureCallback<T>() {
             @Override
-            public void onSuccess(final Void result) {
+            public void onSuccess(final T result) {
                 transactionCompleted();
             }
 
@@ -103,7 +102,7 @@ final class DOMDataBrokerTransactionChainImpl extends
             public void onFailure(final Throwable throwable) {
                 transactionFailed(transaction, throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return ret;
     }
index 68940fd..5c312cc 100644 (file)
@@ -8,8 +8,11 @@
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
 import com.google.common.base.Preconditions;
+import com.google.common.base.Supplier;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Map;
@@ -20,6 +23,8 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFaile
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
+import org.opendaylight.mdsal.common.api.MappingCheckedFuture;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
@@ -68,7 +73,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
 
     /**
      * Future task of transaction commit. It starts off as null, but is
-     * set appropriately on {@link #submit()} and {@link #cancel()} via
+     * set appropriately on {@link #commit()} and {@link #cancel()} via
      * {@link AtomicReferenceFieldUpdater#lazySet(Object, Object)}.
      *
      * <p>
@@ -126,24 +131,34 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
     }
 
     @Override
-    @SuppressWarnings("checkstyle:illegalcatch")
     public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+        return MappingCheckedFuture.create(doCommit(() -> null),
+                TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER);
+    }
+
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        return FluentFuture.from(doCommit(CommitInfo::empty));
+    }
+
+    @SuppressWarnings("checkstyle:IllegalCatch")
+    private <V> ListenableFuture<V> doCommit(Supplier<V> futureValueSupplier) {
         final AbstractDOMForwardedTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
         checkRunning(impl);
 
         final Collection<T> txns = getSubtransactions();
         final Collection<DOMStoreThreePhaseCommitCohort> cohorts = new ArrayList<>(txns.size());
 
-        CheckedFuture<Void, TransactionCommitFailedException> ret;
+        ListenableFuture<V> ret;
         try {
             for (DOMStoreWriteTransaction txn : txns) {
                 cohorts.add(txn.ready());
             }
 
-            ret = impl.submit(this, cohorts);
+            ret = impl.commit(this, cohorts, futureValueSupplier);
         } catch (RuntimeException e) {
-            ret = Futures.immediateFailedCheckedFuture(
-                    TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER.apply(e));
+            ret = FluentFuture.from(Futures.immediateFailedFuture(
+                    TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER.apply(e)));
         }
         FUTURE_UPDATER.lazySet(this, ret);
         return ret;
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongFuture.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongFuture.java
deleted file mode 100644 (file)
index 63aba6e..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.controller.md.sal.dom.broker.impl;
-
-import com.google.common.util.concurrent.AbstractCheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-
-/**
- * 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 exception) {
-        final Throwable cause = exception.getCause();
-        if (cause instanceof TransactionCommitFailedException) {
-            return (TransactionCommitFailedException) cause;
-        } else {
-            return new TransactionCommitFailedException(exception.getMessage(), cause);
-        }
-    }
-}
-
index aa8f3e1..fad3c1c 100644 (file)
@@ -10,27 +10,25 @@ package org.opendaylight.controller.md.sal.dom.broker.impl;
 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.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 
 /**
  * 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;
+final class PingPongTransaction implements FutureCallback<CommitInfo> {
     private final DOMDataReadWriteTransaction delegate;
-    private final SettableFuture<Void> future;
+    private final SettableFuture<CommitInfo> future;
     private DOMDataReadWriteTransaction frontendTransaction;
 
     PingPongTransaction(final DOMDataReadWriteTransaction delegate) {
         this.delegate = Preconditions.checkNotNull(delegate);
         future = SettableFuture.create();
-        submitFuture = new PingPongFuture(future);
     }
 
     DOMDataReadWriteTransaction getTransaction() {
@@ -41,12 +39,12 @@ final class PingPongTransaction implements FutureCallback<Void> {
         return frontendTransaction;
     }
 
-    CheckedFuture<Void, TransactionCommitFailedException> getSubmitFuture() {
-        return submitFuture;
+    ListenableFuture<CommitInfo> getSubmitFuture() {
+        return future;
     }
 
     @Override
-    public void onSuccess(final Void result) {
+    public void onSuccess(final CommitInfo result) {
         future.set(result);
     }
 
index c8027d0..8cda1d5 100644 (file)
@@ -11,8 +11,8 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Verify;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Map.Entry;
@@ -32,6 +32,8 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.controller.md.sal.dom.spi.ForwardingDOMDataReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
+import org.opendaylight.mdsal.common.api.MappingCheckedFuture;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
@@ -192,7 +194,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
             return slowAllocateTransaction();
         }
 
-        // Fast path: reuse current transaction. We will check failures and similar on submit().
+        // Fast path: reuse current transaction. We will check failures and similar on commit().
         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();
@@ -237,9 +239,9 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
             LOG.warn("Submitting transaction {} while {} is still running", tx, inflightTx);
         }
 
-        Futures.addCallback(tx.getTransaction().submit(), new FutureCallback<Void>() {
+        tx.getTransaction().commit().addCallback(new FutureCallback<CommitInfo>() {
             @Override
-            public void onSuccess(final Void result) {
+            public void onSuccess(final CommitInfo result) {
                 transactionSuccessful(tx, result);
             }
 
@@ -285,7 +287,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
         }
     }
 
-    void transactionSuccessful(final PingPongTransaction tx, final Void result) {
+    void transactionSuccessful(final PingPongTransaction tx, final CommitInfo result) {
         LOG.debug("Transaction {} completed successfully", tx);
 
         tx.onSuccess(result);
@@ -450,9 +452,16 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
 
             @Override
             public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+                return MappingCheckedFuture.create(commit().transform(ignored -> null,
+                        MoreExecutors.directExecutor()), TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER);
+            }
+
+            @Override
+            public FluentFuture<? extends CommitInfo> commit() {
                 readyTransaction(tx);
                 isOpen = false;
-                return tx.getSubmitFuture();
+                return FluentFuture.from(tx.getSubmitFuture()).transformAsync(
+                    ignored -> CommitInfo.emptyFluentFuture(), MoreExecutors.directExecutor());
             }
 
             @Override
index 3bb5d5f..db6192b 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
 import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.base.Supplier;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
@@ -21,7 +21,6 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFaile
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import org.opendaylight.mdsal.common.api.MappingCheckedFuture;
 import org.opendaylight.yangtools.util.DurationStatisticsTracker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -63,23 +62,22 @@ public class SerializedDOMDataBroker extends AbstractDOMDataBroker {
     }
 
     @Override
-    protected CheckedFuture<Void, TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
-                                                                           final
-                                                                           Collection<DOMStoreThreePhaseCommitCohort>
-                                                                                   cohorts) {
+    protected <T> ListenableFuture<T> commit(final DOMDataWriteTransaction transaction,
+            final Collection<DOMStoreThreePhaseCommitCohort> cohorts, final Supplier<T> futureValueSupplier) {
         Preconditions.checkArgument(transaction != null, "Transaction must not be null.");
         Preconditions.checkArgument(cohorts != null, "Cohorts must not be null.");
         LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier());
 
-        ListenableFuture<Void> commitFuture = null;
+        ListenableFuture<T> commitFuture;
         try {
-            commitFuture = executor.submit(new CommitCoordinationTask(transaction, cohorts, commitStatsTracker));
+            commitFuture = executor.submit(new CommitCoordinationTask<>(transaction, cohorts, commitStatsTracker,
+                    futureValueSupplier));
         } catch (RejectedExecutionException e) {
             LOG.error("The commit executor's queue is full - submit task was rejected. \n" + executor, e);
-            return Futures.immediateFailedCheckedFuture(new TransactionCommitFailedException(
+            commitFuture = Futures.immediateFailedFuture(new TransactionCommitFailedException(
                     "Could not submit the commit task - the commit queue capacity has been exceeded.", e));
         }
 
-        return MappingCheckedFuture.create(commitFuture, TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER);
+        return commitFuture;
     }
 }
index 3eab723..380f9d5 100644 (file)
@@ -17,6 +17,7 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -32,6 +33,7 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFaile
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
@@ -111,6 +113,11 @@ class ShardedDOMDataBrokerDelegatingReadWriteTransaction implements DOMDataReadW
         return writeTxDelegate.submit();
     }
 
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        return writeTxDelegate.commit();
+    }
+
     @Override
     public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
                                                                                    final YangInstanceIdentifier path) {
index e72d9e0..7ff6728 100644 (file)
@@ -11,11 +11,13 @@ package org.opendaylight.controller.md.sal.dom.broker.impl.legacy.sharded.adapte
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.Futures;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.broker.impl.TransactionCommitFailedExceptionMapper;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -57,6 +59,11 @@ class ShardedDOMDataBrokerDelegatingWriteTransaction implements DOMDataWriteTran
         return Futures.makeChecked(delegateTx.submit(), TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER);
     }
 
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        return delegateTx.commit();
+    }
+
     @Override
     public Object getIdentifier() {
         return txIdentifier;
index 9e76b6b..f98ff6e 100644 (file)
@@ -58,7 +58,7 @@ public class DOMForwardedWriteTransactionTest {
     public void submitRuntimeExceptionAndCancel() {
         RuntimeException thrown = new RuntimeException();
         doReturn(null).when(domStoreWriteTransaction).ready();
-        doThrow(thrown).when(abstractDOMForwardedTransactionFactory).submit(any(), any());
+        doThrow(thrown).when(abstractDOMForwardedTransactionFactory).commit(any(), any(), any());
         DOMForwardedWriteTransaction<DOMStoreWriteTransaction> domForwardedWriteTransaction =
                 new DOMForwardedWriteTransaction<>(
                     new Object(),
@@ -73,4 +73,4 @@ public class DOMForwardedWriteTransactionTest {
             domForwardedWriteTransaction.cancel();
         }
     }
-}
\ No newline at end of file
+}
index ea2bb95..7f450a4 100644 (file)
@@ -10,11 +10,13 @@ package org.opendaylight.controller.md.sal.dom.spi;
 import com.google.common.base.Optional;
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -70,4 +72,9 @@ public abstract class ForwardingDOMDataReadWriteTransaction extends ForwardingOb
     public CheckedFuture<Void, TransactionCommitFailedException> submit() {
         return delegate().submit();
     }
+
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        return delegate().commit();
+    }
 }
index 807ea51..474c151 100644 (file)
@@ -9,10 +9,12 @@ package org.opendaylight.controller.md.sal.dom.spi;
 
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -55,4 +57,9 @@ public abstract class ForwardingDOMDataWriteTransaction extends ForwardingObject
     public CheckedFuture<Void, TransactionCommitFailedException> submit() {
         return delegate().submit();
     }
+
+    @Override
+    public FluentFuture<? extends CommitInfo> commit() {
+        return delegate().commit();
+    }
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.