Reduce use of deprecated methods 03/74803/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 3 Aug 2018 15:12:49 +0000 (17:12 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Sat, 4 Aug 2018 02:16:27 +0000 (02:16 +0000)
We do not really need the old semantics in a lot of sites, so
migrate them over to replacement methods.

Change-Id: Ib60e395dd9da82934d1591555c9ad46c05dac0e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
13 files changed:
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaWrite.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxDomDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxDomWrite.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaWrite.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainDomDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainDomWrite.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/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerPerformanceTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataTreeListenerTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMTransactionChainTest.java

index 160f488..ec23f9a 100644 (file)
@@ -10,11 +10,11 @@ package org.opendaylight.dsbenchmark;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.Collections;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.atomic.AtomicReference;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 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.DOMDataBroker;
 import org.opendaylight.dsbenchmark.listener.DsbenchmarkListenerProvider;
 import org.opendaylight.dsbenchmark.simpletx.SimpletxBaDelete;
@@ -175,8 +175,8 @@ public class DsbenchmarkProvider implements DsbenchmarkService, AutoCloseable {
         tx.put(LogicalDatastoreType.OPERATIONAL, TEST_STATUS_IID, status);
 
         try {
-            tx.submit().checkedGet();
-        } catch (final TransactionCommitFailedException e) {
+            tx.commit().get();
+        } catch (final InterruptedException | ExecutionException e) {
             throw new IllegalStateException(e);
         }
 
@@ -191,9 +191,9 @@ public class DsbenchmarkProvider implements DsbenchmarkService, AutoCloseable {
         WriteTransaction tx = simpleTxDataBroker.newWriteOnlyTransaction();
         tx.put(LogicalDatastoreType.CONFIGURATION, TEST_EXEC_IID, data);
         try {
-            tx.submit().checkedGet();
+            tx.commit().get();
             LOG.debug("DataStore config test data cleaned up");
-        } catch (final TransactionCommitFailedException e) {
+        } catch (final InterruptedException | ExecutionException e) {
             LOG.info("Failed to cleanup DataStore configtest data");
             throw new IllegalStateException(e);
         }
@@ -201,9 +201,9 @@ public class DsbenchmarkProvider implements DsbenchmarkService, AutoCloseable {
         tx = simpleTxDataBroker.newWriteOnlyTransaction();
         tx.put(LogicalDatastoreType.OPERATIONAL, TEST_EXEC_IID, data);
         try {
-            tx.submit().checkedGet();
+            tx.commit().get();
             LOG.debug("DataStore operational test data cleaned up");
-        } catch (final TransactionCommitFailedException e) {
+        } catch (final InterruptedException | ExecutionException e) {
             LOG.info("Failed to cleanup DataStore operational test data");
             throw new IllegalStateException(e);
         }
index a165ea0..85a4124 100644 (file)
@@ -5,14 +5,12 @@
  * 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.dsbenchmark.simpletx;
 
-
+import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.DataStore;
@@ -63,9 +61,9 @@ public class SimpletxBaDelete extends DatastoreAbstractWriter {
             putCnt++;
             if (putCnt == writesPerTx) {
                 try {
-                    tx.submit().checkedGet();
+                    tx.commit().get();
                     txOk++;
-                } catch (final TransactionCommitFailedException e) {
+                } catch (final InterruptedException | ExecutionException e) {
                     LOG.error("Transaction failed: {}", e);
                     txError++;
                 }
@@ -75,8 +73,8 @@ public class SimpletxBaDelete extends DatastoreAbstractWriter {
         }
         if (putCnt != 0) {
             try {
-                tx.submit().checkedGet();
-            } catch (final TransactionCommitFailedException e) {
+                tx.commit().get();
+            } catch (final InterruptedException | ExecutionException e) {
                 LOG.error("Transaction failed: {}", e);
             }
         }
index 1fef7f8..ed4d0a4 100644 (file)
@@ -9,10 +9,10 @@
 package org.opendaylight.dsbenchmark.simpletx;
 
 import java.util.List;
+import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.dsbenchmark.BaListBuilder;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
@@ -60,9 +60,9 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter {
 
             if (writeCnt == writesPerTx) {
                 try {
-                    tx.submit().checkedGet();
+                    tx.commit().get();
                     txOk++;
-                } catch (final TransactionCommitFailedException e) {
+                } catch (final InterruptedException | ExecutionException e) {
                     LOG.error("Transaction failed: {}", e);
                     txError++;
                 }
@@ -74,8 +74,8 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter {
 
         if (writeCnt != 0) {
             try {
-                tx.submit().checkedGet();
-            } catch (final TransactionCommitFailedException e) {
+                tx.commit().get();
+            } catch (final InterruptedException | ExecutionException e) {
                 LOG.error("Transaction failed: {}", e);
             }
         }
index 58baedb..af9ad55 100644 (file)
@@ -8,8 +8,8 @@
 
 package org.opendaylight.dsbenchmark.simpletx;
 
+import java.util.concurrent.ExecutionException;
 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.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
@@ -67,9 +67,9 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
             writeCnt++;
             if (writeCnt == writesPerTx) {
                 try {
-                    tx.submit().checkedGet();
+                    tx.commit().get();
                     txOk++;
-                } catch (final TransactionCommitFailedException e) {
+                } catch (final  InterruptedException | ExecutionException e) {
                     LOG.error("Transaction failed: {}", e);
                     txError++;
                 }
@@ -79,8 +79,8 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
         }
         if (writeCnt != 0) {
             try {
-                tx.submit().checkedGet();
-            } catch (final TransactionCommitFailedException e) {
+                tx.commit().get();
+            } catch (final InterruptedException | ExecutionException e) {
                 LOG.error("Transaction failed: {}", e);
             }
         }
index e55724d..49765b3 100644 (file)
@@ -9,8 +9,8 @@
 package org.opendaylight.dsbenchmark.simpletx;
 
 import java.util.List;
+import java.util.concurrent.ExecutionException;
 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.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
@@ -65,9 +65,9 @@ public class SimpletxDomWrite extends DatastoreAbstractWriter {
 
             if (writeCnt == writesPerTx) {
                 try {
-                    tx.submit().checkedGet();
+                    tx.commit().get();
                     txOk++;
-                } catch (final TransactionCommitFailedException e) {
+                } catch (final InterruptedException | ExecutionException e) {
                     LOG.error("Transaction failed", e);
                     txError++;
                 }
@@ -78,12 +78,10 @@ public class SimpletxDomWrite extends DatastoreAbstractWriter {
 
         if (writeCnt != 0) {
             try {
-                tx.submit().checkedGet();
-            } catch (final TransactionCommitFailedException e) {
+                tx.commit().get();
+            } catch (final InterruptedException | ExecutionException e) {
                 LOG.error("Transaction failed", e);
             }
         }
-
     }
-
 }
index a8363df..44fcc97 100644 (file)
@@ -9,7 +9,8 @@
 package org.opendaylight.dsbenchmark.txchain;
 
 import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
@@ -17,8 +18,8 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 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.dsbenchmark.DatastoreAbstractWriter;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.DataStore;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
@@ -73,9 +74,9 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
 
             if (writeCnt == writesPerTx) {
                 txSubmitted++;
-                Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
+                tx.commit().addCallback(new FutureCallback<CommitInfo>() {
                     @Override
-                    public void onSuccess(final Void result) {
+                    public void onSuccess(final CommitInfo result) {
                         txOk++;
                     }
 
@@ -84,7 +85,7 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
                         LOG.error("Transaction failed, {}", t);
                         txError++;
                     }
-                });
+                }, MoreExecutors.directExecutor());
                 tx = chain.newWriteOnlyTransaction();
                 writeCnt = 0;
             }
@@ -96,8 +97,8 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
             if (writeCnt > 0) {
                 txSubmitted++;
             }
-            tx.submit().checkedGet();
-        } catch (final TransactionCommitFailedException e) {
+            tx.commit().get();
+        } catch (final InterruptedException | ExecutionException e) {
             LOG.error("Transaction failed", e);
         }
         try {
@@ -105,7 +106,7 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
         } catch (final IllegalStateException e) {
             LOG.error("Transaction close failed,", e);
         }
-        LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
+        LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, txOk + txError);
     }
 
     @Override
index b36404d..927ec45 100644 (file)
@@ -9,9 +9,9 @@
 package org.opendaylight.dsbenchmark.txchain;
 
 import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.List;
+import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
@@ -19,9 +19,9 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 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.dsbenchmark.BaListBuilder;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.DataStore;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.Operation;
@@ -71,9 +71,9 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
 
             if (writeCnt == writesPerTx) {
                 txSubmitted++;
-                Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
+                tx.commit().addCallback(new FutureCallback<CommitInfo>() {
                     @Override
-                    public void onSuccess(final Void result) {
+                    public void onSuccess(final CommitInfo result) {
                         txOk++;
                     }
 
@@ -93,9 +93,9 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
         // We need to empty the transaction chain before closing it
         try {
             txSubmitted++;
-            tx.submit().checkedGet();
+            tx.commit().get();
             txOk++;
-        } catch (final TransactionCommitFailedException e) {
+        } catch (final InterruptedException | ExecutionException e) {
             LOG.error("Transaction failed", e);
             txError++;
         }
index 8e32897..a1efbfa 100644 (file)
@@ -5,20 +5,20 @@
  * 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.dsbenchmark.txchain;
 
 import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 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.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.DataStore;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
@@ -76,9 +76,9 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
 
             if (writeCnt == writesPerTx) {
                 txSubmitted++;
-                Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
+                tx.commit().addCallback(new FutureCallback<CommitInfo>() {
                     @Override
-                    public void onSuccess(final Void result) {
+                    public void onSuccess(final CommitInfo result) {
                         txOk++;
                     }
 
@@ -87,7 +87,7 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
                         LOG.error("Transaction failed, {}", t);
                         txError++;
                     }
-                });
+                }, MoreExecutors.directExecutor());
                 tx = chain.newWriteOnlyTransaction();
                 writeCnt = 0;
             }
@@ -98,9 +98,9 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
         // We need to empty the transaction chain before closing it
         try {
             txSubmitted++;
-            tx.submit().checkedGet();
+            tx.commit().get();
             txOk++;
-        } catch (final TransactionCommitFailedException e) {
+        } catch (final InterruptedException | ExecutionException e) {
             LOG.error("Transaction failed", e);
             txError++;
         }
@@ -109,7 +109,7 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
         } catch (final IllegalStateException e) {
             LOG.error("Transaction close failed,", e);
         }
-        LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
+        LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, txOk + txError);
     }
 
     @Override
index 52f574a..e26f284 100644 (file)
@@ -9,18 +9,19 @@
 package org.opendaylight.dsbenchmark.txchain;
 
 import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.List;
+import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 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.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
 import org.opendaylight.dsbenchmark.DomListBuilder;
+import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.DataStore;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
@@ -74,9 +75,9 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
             // Start performing the operation; submit the transaction at every n-th operation
             if (writeCnt == writesPerTx) {
                 txSubmitted++;
-                Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
+                tx.commit().addCallback(new FutureCallback<CommitInfo>() {
                     @Override
-                    public void onSuccess(final Void result) {
+                    public void onSuccess(final CommitInfo result) {
                         txOk++;
                     }
 
@@ -85,7 +86,7 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
                         LOG.error("Transaction failed, {}", t);
                         txError++;
                     }
-                });
+                }, MoreExecutors.directExecutor());
                 tx = chain.newWriteOnlyTransaction();
                 writeCnt = 0;
             }
@@ -97,9 +98,9 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
 
         try {
             txSubmitted++;
-            tx.submit().checkedGet();
+            tx.commit().get();
             txOk++;
-        } catch (final TransactionCommitFailedException e) {
+        } catch (final InterruptedException | ExecutionException e) {
             LOG.error("Transaction failed", e);
             txError++;
         }
@@ -109,7 +110,7 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
             LOG.error("Transaction close failed,", e);
         }
 
-        LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
+        LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, txOk + txError);
     }
 
     @Override
index 8c4ac63..5ee9c43 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.controller.md.sal.dom.broker.impl.legacy.sharded.adapte
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
 
-import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
@@ -144,10 +143,8 @@ class ShardedDOMDataBrokerDelegatingReadWriteTransaction implements DOMDataReadW
                                                               final YangInstanceIdentifier path) {
         checkState(root != null,
                    "A modify operation (put, merge or delete) must be performed prior to an exists operation");
-        return Futures.makeChecked(Futures.transform(read(store, path),
-                                                     (Function<Optional<NormalizedNode<?, ?>>, Boolean>)
-                                                             Optional::isPresent),
-                                   ReadFailedException.MAPPER);
+        return Futures.makeChecked(Futures.transform(read(store, path), Optional::isPresent,
+            MoreExecutors.directExecutor()), ReadFailedException.MAPPER);
     }
 
     @Override
index 72a3c2e..640d603 100644 (file)
@@ -148,7 +148,7 @@ public class DOMBrokerPerformanceTest {
             List<ListenableFuture<?>> allFutures = measure(txNum + " Submits", () -> {
                 List<ListenableFuture<?>> builder = new ArrayList<>(txNum);
                 for (DOMDataReadWriteTransaction tx : transactions) {
-                    builder.add(tx.submit());
+                    builder.add(tx.commit());
                 }
                 return builder;
             });
@@ -213,7 +213,7 @@ public class DOMBrokerPerformanceTest {
         });
 
         measure("Txs:1 Submit, Finish", (Callable<Void>) () -> {
-            measure("Txs:1 Submit", (Callable<ListenableFuture<?>>) writeTx::submit).get();
+            measure("Txs:1 Submit", (Callable<ListenableFuture<?>>) writeTx::commit).get();
             return null;
         });
     }
index bad4927..51f0c04 100644 (file)
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
@@ -31,7 +32,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitDeadlockException;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
@@ -133,7 +133,7 @@ public class DOMDataTreeListenerTest {
 
         final DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
-        writeTx.submit();
+        writeTx.commit();
 
         latch.await(5, TimeUnit.SECONDS);
 
@@ -149,7 +149,7 @@ public class DOMDataTreeListenerTest {
     }
 
     @Test
-    public void replaceContainerContainerInTreeTest() throws InterruptedException, TransactionCommitFailedException {
+    public void replaceContainerContainerInTreeTest() throws InterruptedException, ExecutionException {
         final CountDownLatch latch = new CountDownLatch(2);
 
         DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
@@ -157,14 +157,14 @@ public class DOMDataTreeListenerTest {
 
         DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
-        writeTx.submit().checkedGet();
+        writeTx.commit().get();
 
         final TestDataTreeListener listener = new TestDataTreeListener(latch);
         final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
                 .registerDataTreeChangeListener(ROOT_DATA_TREE_ID, listener);
         writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER_2);
-        writeTx.submit();
+        writeTx.commit();
 
         latch.await(5, TimeUnit.SECONDS);
 
@@ -188,7 +188,7 @@ public class DOMDataTreeListenerTest {
     }
 
     @Test
-    public void deleteContainerContainerInTreeTest() throws InterruptedException, TransactionCommitFailedException {
+    public void deleteContainerContainerInTreeTest() throws InterruptedException, ExecutionException {
         final CountDownLatch latch = new CountDownLatch(2);
 
         DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
@@ -196,7 +196,7 @@ public class DOMDataTreeListenerTest {
 
         DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
-        writeTx.submit().checkedGet();
+        writeTx.commit().get();
 
         final TestDataTreeListener listener = new TestDataTreeListener(latch);
         final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
@@ -204,7 +204,7 @@ public class DOMDataTreeListenerTest {
 
         writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.delete(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH);
-        writeTx.submit();
+        writeTx.commit();
 
         latch.await(5, TimeUnit.SECONDS);
 
@@ -228,7 +228,7 @@ public class DOMDataTreeListenerTest {
     }
 
     @Test
-    public void replaceChildListContainerInTreeTest() throws InterruptedException, TransactionCommitFailedException {
+    public void replaceChildListContainerInTreeTest() throws InterruptedException, ExecutionException {
         final CountDownLatch latch = new CountDownLatch(2);
 
         DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
@@ -236,7 +236,7 @@ public class DOMDataTreeListenerTest {
 
         DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
-        writeTx.submit().checkedGet();
+        writeTx.commit().get();
 
         final TestDataTreeListener listener = new TestDataTreeListener(latch);
         final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
@@ -244,7 +244,7 @@ public class DOMDataTreeListenerTest {
 
         writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.OUTER_LIST_PATH, OUTER_LIST_2);
-        writeTx.submit();
+        writeTx.commit();
 
         latch.await(5, TimeUnit.SECONDS);
 
@@ -272,7 +272,7 @@ public class DOMDataTreeListenerTest {
     }
 
     @Test
-    public void rootModificationChildListenerTest() throws InterruptedException, TransactionCommitFailedException {
+    public void rootModificationChildListenerTest() throws InterruptedException, ExecutionException {
         final CountDownLatch latch = new CountDownLatch(2);
 
         DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
@@ -280,7 +280,7 @@ public class DOMDataTreeListenerTest {
 
         DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
-        writeTx.submit().checkedGet();
+        writeTx.commit().get();
 
         final TestDataTreeListener listener = new TestDataTreeListener(latch);
         final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
@@ -288,7 +288,7 @@ public class DOMDataTreeListenerTest {
 
         writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER_2);
-        writeTx.submit().checkedGet();
+        writeTx.commit().get();
 
         latch.await(1, TimeUnit.SECONDS);
 
@@ -312,7 +312,7 @@ public class DOMDataTreeListenerTest {
     }
 
     @Test
-    public void listEntryChangeNonRootRegistrationTest() throws InterruptedException, TransactionCommitFailedException {
+    public void listEntryChangeNonRootRegistrationTest() throws InterruptedException, ExecutionException {
         final CountDownLatch latch = new CountDownLatch(2);
 
         DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
@@ -320,7 +320,7 @@ public class DOMDataTreeListenerTest {
 
         DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
-        writeTx.submit().checkedGet();
+        writeTx.commit().get();
 
         final TestDataTreeListener listener = new TestDataTreeListener(latch);
         final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
@@ -349,7 +349,7 @@ public class DOMDataTreeListenerTest {
                     outerListEntry2);
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.OUTER_LIST_PATH.node(outerListEntryId3),
                     outerListEntry3);
-        writeTx.submit();
+        writeTx.commit();
 
         latch.await(5, TimeUnit.SECONDS);
 
index f36a75d..5815fae 100644 (file)
@@ -73,7 +73,7 @@ public class DOMTransactionChainTest {
          * First transaction is marked as ready, we are able to allocate chained
          * transactions.
          */
-        ListenableFuture<Void> firstWriteTxFuture = firstTx.submit();
+        ListenableFuture<?> firstWriteTxFuture = firstTx.commit();
 
         /**
          * We alocate chained transaction - read transaction.
@@ -114,7 +114,7 @@ public class DOMTransactionChainTest {
         /**
          * third transaction is sealed and commited.
          */
-        ListenableFuture<Void> thirdDeleteTxFuture = thirdDeleteTx.submit();
+        ListenableFuture<?> thirdDeleteTxFuture = thirdDeleteTx.commit();
         assertCommitSuccessful(thirdDeleteTxFuture);
 
         /**
@@ -168,27 +168,27 @@ public class DOMTransactionChainTest {
         return tx;
     }
 
-    private static DOMDataReadWriteTransaction allocateAndWrite(
-            final DOMTransactionChain txChain) throws InterruptedException, ExecutionException {
+    private static DOMDataReadWriteTransaction allocateAndWrite(final DOMTransactionChain txChain)
+            throws InterruptedException, ExecutionException {
         DOMDataReadWriteTransaction tx = txChain.newReadWriteTransaction();
         assertTestContainerWrite(tx);
         return tx;
     }
 
-    private static void assertCommitSuccessful(
-            final ListenableFuture<Void> future) throws InterruptedException, ExecutionException {
+    private static void assertCommitSuccessful(final ListenableFuture<?> future)
+            throws InterruptedException, ExecutionException {
         future.get();
     }
 
-    private static void assertTestContainerExists(
-            final DOMDataReadTransaction readTx) throws InterruptedException, ExecutionException {
+    private static void assertTestContainerExists(final DOMDataReadTransaction readTx)
+            throws InterruptedException, ExecutionException {
         ListenableFuture<Optional<NormalizedNode<?, ?>>> readFuture = readTx.read(OPERATIONAL, TestModel.TEST_PATH);
         Optional<NormalizedNode<?, ?>> readedData = readFuture.get();
         assertTrue(readedData.isPresent());
     }
 
-    private static void assertTestContainerWrite(
-            final DOMDataReadWriteTransaction tx) throws InterruptedException, ExecutionException {
+    private static void assertTestContainerWrite(final DOMDataReadWriteTransaction tx)
+            throws InterruptedException, ExecutionException {
         tx.put(OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
         assertTestContainerExists(tx);
     }

©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.