Refactor DOMDataBrokerImpl 78/13078/6
authorRobert Varga <rovarga@cisco.com>
Mon, 24 Nov 2014 14:15:42 +0000 (15:15 +0100)
committerRobert Varga <rovarga@cisco.com>
Tue, 2 Dec 2014 16:40:23 +0000 (16:40 +0000)
This patch shuffles the abstractions, eliminating two intermediate
interfaces and ensuring proper layring is maintained with
AbstractDataBroker serving as a base for the Concurrent and Serialized
versions.

Change-Id: If363aa796db0c2ebf22fdefe7659dd428745dc75
Signed-off-by: Robert Varga <rovarga@cisco.com>
20 files changed:
opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryBrokerWriteTransactionBenchmark.java
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/DataBrokerTestCustomizer.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomInmemoryDataBrokerModule.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMDataBroker.java [new file with mode: 0644]
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/ConcurrentDOMDataBroker.java [moved from opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMConcurrentDataCommitCoordinator.java with 96% similarity]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataBrokerImpl.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/DOMDataCommitExecutor.java [deleted file]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitImplementation.java [deleted file]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedReadWriteTransaction.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/SerializedDOMDataBroker.java [moved from opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitCoordinatorImpl.java with 82% similarity]
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/DOMBrokerTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMConcurrentDataCommitCoordinatorTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMTransactionChainTest.java
opendaylight/md-sal/statistics-manager/src/test/java/test/mock/util/DataBrokerTestCustomizer.java

index 276f4ec..e6a1642 100644 (file)
@@ -15,7 +15,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
 import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -47,7 +47,7 @@ public class InMemoryBrokerWriteTransactionBenchmark extends AbstractInMemoryBro
             LogicalDatastoreType.OPERATIONAL, (DOMStore)operStore,
             LogicalDatastoreType.CONFIGURATION, configStore);
 
-        domBroker = new DOMDataBrokerImpl(datastores, executor);
+        domBroker = new SerializedDOMDataBroker(datastores, executor);
         schemaContext = BenchmarkModel.createTestContext();
         configStore.onGlobalContextUpdated(schemaContext);
         operStore.onGlobalContextUpdated(schemaContext);
index 3070499..de7d33e 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompati
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
@@ -68,7 +68,7 @@ public class DataBrokerTestCustomizer {
     }
 
     public DOMDataBroker createDOMDataBroker() {
-        return new DOMDataBrokerImpl(getDatastores(), getCommitCoordinatorExecutor());
+        return new SerializedDOMDataBroker(getDatastores(), getCommitCoordinatorExecutor());
     }
 
     public ListeningExecutorService getCommitCoordinatorExecutor() {
index d99ac6f..38b36b3 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCo
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.binding.test.util.MockSchemaService;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
@@ -68,7 +68,7 @@ public class DataBrokerTestCustomizer {
     }
 
     public DOMDataBroker createDOMDataBroker() {
-        return new DOMDataBrokerImpl(getDatastores(), getCommitCoordinatorExecutor());
+        return new SerializedDOMDataBroker(getDatastores(), getCommitCoordinatorExecutor());
     }
 
     public ListeningExecutorService getCommitCoordinatorExecutor() {
index 979f9aa..6ad93aa 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompati
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
@@ -144,7 +144,7 @@ public class BindingTestContext implements AutoCloseable {
                 .put(LogicalDatastoreType.CONFIGURATION, configStore)
                 .build();
 
-        newDOMDataBroker = new DOMDataBrokerImpl(newDatastores, executor);
+        newDOMDataBroker = new SerializedDOMDataBroker(newDatastores, executor);
 
         biCompatibleBroker = new BackwardsCompatibleDataBroker(newDOMDataBroker,mockSchemaService);
 
index 8f01a39..fcbce6f 100644 (file)
@@ -15,10 +15,9 @@ 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.util.jmx.AbstractMXBean;
 import org.opendaylight.controller.md.sal.common.util.jmx.ThreadExecutorStatsMXBeanImpl;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMConcurrentDataCommitCoordinator;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataCommitCoordinatorImpl;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataCommitExecutor;
+import org.opendaylight.controller.md.sal.dom.broker.impl.ConcurrentDOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.broker.impl.AbstractDOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.broker.impl.jmx.CommitStatsMXBeanImpl;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreFactory;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
@@ -85,14 +84,13 @@ public final class DomInmemoryDataBrokerModule extends
 
         final List<AbstractMXBean> mBeans = Lists.newArrayList();
 
-        DOMDataCommitExecutor commitCoordinator;
-        DurationStatisticsTracker commitStatsTracker = null;
+        final DurationStatisticsTracker commitStatsTracker;
+        final AbstractDOMDataBroker broker;
 
-        if(getAllowConcurrentCommits()) {
-            DOMConcurrentDataCommitCoordinator coordinator =
-                    new DOMConcurrentDataCommitCoordinator(listenableFutureExecutor);
-            commitStatsTracker = coordinator.getCommitStatsTracker();
-            commitCoordinator = coordinator;
+        if (getAllowConcurrentCommits()) {
+            final ConcurrentDOMDataBroker cdb = new ConcurrentDOMDataBroker(datastores, listenableFutureExecutor);
+            commitStatsTracker = cdb.getCommitStatsTracker();
+            broker = cdb;
         } else {
             /*
              * We use a single-threaded executor for commits with a bounded queue capacity. If the
@@ -105,13 +103,12 @@ public final class DomInmemoryDataBrokerModule extends
             ExecutorService commitExecutor = SpecialExecutors.newBoundedSingleThreadExecutor(
                     getMaxDataBrokerCommitQueueSize(), "WriteTxCommit");
 
-            DOMDataCommitCoordinatorImpl coordinator = new DOMDataCommitCoordinatorImpl(
+            SerializedDOMDataBroker sdb = new SerializedDOMDataBroker(datastores,
                     new DeadlockDetectingListeningExecutorService(commitExecutor,
                             TransactionCommitDeadlockException.DEADLOCK_EXCEPTION_SUPPLIER,
                             listenableFutureExecutor));
-
-            commitStatsTracker = coordinator.getCommitStatsTracker();
-            commitCoordinator = coordinator;
+            commitStatsTracker = sdb.getCommitStatsTracker();
+            broker = sdb;
 
             final AbstractMXBean commitExecutorStatsMXBean =
                     ThreadExecutorStatsMXBeanImpl.create(commitExecutor, "CommitExecutorStats",
@@ -121,8 +118,6 @@ public final class DomInmemoryDataBrokerModule extends
             }
         }
 
-        DOMDataBrokerImpl newDataBroker = new DOMDataBrokerImpl(datastores, commitCoordinator);
-
         if(commitStatsTracker != null) {
             final CommitStatsMXBeanImpl commitStatsMXBean = new CommitStatsMXBeanImpl(
                     commitStatsTracker, JMX_BEAN_TYPE);
@@ -137,7 +132,7 @@ public final class DomInmemoryDataBrokerModule extends
             mBeans.add(commitFutureStatsMXBean);
         }
 
-        newDataBroker.setCloseable(new AutoCloseable() {
+        broker.setCloseable(new AutoCloseable() {
             @Override
             public void close() {
                 for(AbstractMXBean mBean: mBeans) {
@@ -146,6 +141,6 @@ public final class DomInmemoryDataBrokerModule extends
             }
         });
 
-        return newDataBroker;
+        return broker;
     }
 }
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMDataBroker.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMDataBroker.java
new file mode 100644 (file)
index 0000000..b705bd6
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * 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 static com.google.common.base.Preconditions.checkState;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.atomic.AtomicLong;
+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.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
+import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractDOMDataBroker extends AbstractDOMForwardedTransactionFactory<DOMStore> implements DOMDataBroker, AutoCloseable {
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractDOMDataBroker.class);
+
+    private final AtomicLong txNum = new AtomicLong();
+    private final AtomicLong chainNum = new AtomicLong();
+    private volatile AutoCloseable closeable;
+
+    protected AbstractDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores) {
+        super(datastores);
+    }
+
+    public void setCloseable(final AutoCloseable closeable) {
+        this.closeable = closeable;
+    }
+
+    @Override
+    public void close() {
+        super.close();
+
+        if(closeable != null) {
+            try {
+                closeable.close();
+            } catch(Exception e) {
+                LOG.debug("Error closing instance", e);
+            }
+        }
+    }
+
+    @Override
+    protected Object newTransactionIdentifier() {
+        return "DOM-" + txNum.getAndIncrement();
+    }
+
+    @Override
+    public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
+            final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
+
+        DOMStore potentialStore = getTxFactories().get(store);
+        checkState(potentialStore != null, "Requested logical data store is not available.");
+        return potentialStore.registerChangeListener(path, listener, triggeringScope);
+    }
+
+    @Override
+    public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
+        checkNotClosed();
+
+        final Map<LogicalDatastoreType, DOMStoreTransactionChain> backingChains = new EnumMap<>(LogicalDatastoreType.class);
+        for (Entry<LogicalDatastoreType, DOMStore> entry : getTxFactories().entrySet()) {
+            backingChains.put(entry.getKey(), entry.getValue().createTransactionChain());
+        }
+
+        final long chainId = chainNum.getAndIncrement();
+        LOG.debug("Transactoin chain {} created with listener {}, backing store chains {}", chainId, listener,
+                backingChains);
+        return new DOMDataBrokerTransactionChainImpl(chainId, backingChains, this, listener);
+    }
+}
index c1ac0e1..08888c1 100644 (file)
@@ -8,16 +8,19 @@
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
 import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.CheckedFuture;
 import java.util.EnumMap;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 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.DOMDataReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionFactory;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 
@@ -37,7 +40,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
  * @param <T>
  *            Type of {@link DOMStoreTransactionFactory} factory.
  */
-abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransactionFactory> implements DOMDataCommitImplementation, AutoCloseable {
+abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransactionFactory> implements AutoCloseable {
     @SuppressWarnings("rawtypes")
     private static final AtomicIntegerFieldUpdater<AbstractDOMForwardedTransactionFactory> UPDATER =
             AtomicIntegerFieldUpdater.newUpdater(AbstractDOMForwardedTransactionFactory.class, "closed");
@@ -56,6 +59,26 @@ abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransact
      */
     protected abstract Object newTransactionIdentifier();
 
+    /**
+     * User-supplied implementation of {@link DOMDataWriteTransaction#submit()}
+     * for transaction.
+     *
+     * Callback invoked when {@link DOMDataWriteTransaction#submit()} is invoked
+     * on transaction created by this factory.
+     *
+     * @param transaction
+     *            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,
+     *         the Future fails with a {@link TransactionCommitFailedException}.
+     */
+    protected abstract CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
+            final Iterable<DOMStoreThreePhaseCommitCohort> cohorts);
+
     /**
      * Creates a new composite read-only transaction
      *
@@ -16,12 +16,15 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
+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.sal.core.spi.data.DOMStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.yangtools.util.DurationStatisticsTracker;
 import org.opendaylight.yangtools.util.concurrent.MappingCheckedFuture;
@@ -35,14 +38,12 @@ import org.slf4j.LoggerFactory;
  *
  * @author Thomas Pantelis
  */
-public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor {
-
+public class ConcurrentDOMDataBroker extends AbstractDOMDataBroker {
+    private static final Logger LOG = LoggerFactory.getLogger(ConcurrentDOMDataBroker.class);
     private static final String CAN_COMMIT = "CAN_COMMIT";
     private static final String PRE_COMMIT = "PRE_COMMIT";
     private static final String COMMIT = "COMMIT";
 
-    private static final Logger LOG = LoggerFactory.getLogger(DOMConcurrentDataCommitCoordinator.class);
-
     private final DurationStatisticsTracker commitStatsTracker = DurationStatisticsTracker.createConcurrent();
 
     /**
@@ -56,7 +57,8 @@ public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor
      */
     private final ExecutorService internalFutureCallbackExecutor = new SimpleSameThreadExecutor();
 
-    public DOMConcurrentDataCommitCoordinator(ExecutorService listenableFutureExecutor) {
+    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, ExecutorService listenableFutureExecutor) {
+        super(datastores);
         this.clientFutureCallbackExecutor = Preconditions.checkNotNull(listenableFutureExecutor);
     }
 
index 3f7db01..fb5e438 100644 (file)
  */
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
-import static com.google.common.base.Preconditions.checkState;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
-import java.util.EnumMap;
 import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.atomic.AtomicLong;
 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.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
-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.DOMStore;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class DOMDataBrokerImpl extends AbstractDOMForwardedTransactionFactory<DOMStore> implements DOMDataBroker,
-        AutoCloseable {
-
-    private static final Logger LOG = LoggerFactory.getLogger(DOMDataBrokerImpl.class);
-
-    private final DOMDataCommitExecutor coordinator;
-    private final AtomicLong txNum = new AtomicLong();
-    private final AtomicLong chainNum = new AtomicLong();
-    private volatile AutoCloseable closeable;
-
-    public DOMDataBrokerImpl(final Map<LogicalDatastoreType, DOMStore> datastores,
-            final ListeningExecutorService executor) {
-        this(datastores, new DOMDataCommitCoordinatorImpl(executor));
-    }
-
-    public DOMDataBrokerImpl(final Map<LogicalDatastoreType, DOMStore> datastores,
-            final DOMDataCommitExecutor coordinator) {
-        super(datastores);
-        this.coordinator = Preconditions.checkNotNull(coordinator);
-    }
-
-    public void setCloseable(final AutoCloseable closeable) {
-        this.closeable = closeable;
-    }
-
-    @Override
-    public void close() {
-        super.close();
-
-        if(closeable != null) {
-            try {
-                closeable.close();
-            } catch(Exception e) {
-                LOG.debug("Error closing instance", e);
-            }
-        }
-    }
-
-    @Override
-    protected Object newTransactionIdentifier() {
-        return "DOM-" + txNum.getAndIncrement();
-    }
-
-    @Override
-    public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
-            final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
-
-        DOMStore potentialStore = getTxFactories().get(store);
-        checkState(potentialStore != null, "Requested logical data store is not available.");
-        return potentialStore.registerChangeListener(path, listener, triggeringScope);
-    }
-
-    @Override
-    public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
-        checkNotClosed();
-
-        final Map<LogicalDatastoreType, DOMStoreTransactionChain> backingChains = new EnumMap<>(LogicalDatastoreType.class);
-        for (Entry<LogicalDatastoreType, DOMStore> entry : getTxFactories().entrySet()) {
-            backingChains.put(entry.getKey(), entry.getValue().createTransactionChain());
-        }
-
-        final long chainId = chainNum.getAndIncrement();
-        LOG.debug("Transactoin chain {} created with listener {}, backing store chains {}", chainId, listener,
-                backingChains);
-        return new DOMDataBrokerTransactionChainImpl(chainId, backingChains, coordinator, listener);
-
-    }
-
-    @Override
-    public CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
-            final Iterable<DOMStoreThreePhaseCommitCohort> cohorts) {
-        LOG.debug("Transaction: {} submitted with cohorts {}.", transaction.getIdentifier(), cohorts);
-        return coordinator.submit(transaction, cohorts);
+/**
+ * @deprecated Compatibility wrapper around {@link SerializedDOMDataBroker}.
+ */
+@Deprecated
+public final class DOMDataBrokerImpl extends SerializedDOMDataBroker {
+    public DOMDataBrokerImpl(final Map<LogicalDatastoreType, DOMStore> datastores, final ListeningExecutorService executor) {
+        super(datastores, executor);
     }
 }
index 0b1dd1c..77387c7 100644 (file)
@@ -45,7 +45,7 @@ final class DOMDataBrokerTransactionChainImpl extends AbstractDOMForwardedTransa
             AtomicReferenceFieldUpdater.newUpdater(DOMDataBrokerTransactionChainImpl.class, State.class, "state");
     private static final Logger LOG = LoggerFactory.getLogger(DOMDataBrokerTransactionChainImpl.class);
     private final AtomicLong txNum = new AtomicLong();
-    private final DOMDataCommitExecutor coordinator;
+    private final AbstractDOMDataBroker broker;
     private final TransactionChainListener listener;
     private final long chainId;
 
@@ -69,10 +69,10 @@ final class DOMDataBrokerTransactionChainImpl extends AbstractDOMForwardedTransa
      */
     public DOMDataBrokerTransactionChainImpl(final long chainId,
             final Map<LogicalDatastoreType, DOMStoreTransactionChain> chains,
-            final DOMDataCommitExecutor coordinator, final TransactionChainListener listener) {
+            final AbstractDOMDataBroker broker, final TransactionChainListener listener) {
         super(chains);
         this.chainId = chainId;
-        this.coordinator = Preconditions.checkNotNull(coordinator);
+        this.broker = Preconditions.checkNotNull(broker);
         this.listener = Preconditions.checkNotNull(listener);
     }
 
@@ -91,7 +91,7 @@ final class DOMDataBrokerTransactionChainImpl extends AbstractDOMForwardedTransa
         checkNotFailed();
         checkNotClosed();
 
-        final CheckedFuture<Void, TransactionCommitFailedException> ret = coordinator.submit(transaction, cohorts);
+        final CheckedFuture<Void, TransactionCommitFailedException> ret = broker.submit(transaction, cohorts);
 
         COUNTER_UPDATER.incrementAndGet(this);
         Futures.addCallback(ret, new FutureCallback<Void>() {
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitExecutor.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitExecutor.java
deleted file mode 100644 (file)
index dae14b5..0000000
+++ /dev/null
@@ -1,46 +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.CheckedFuture;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-
-/**
- * Executor of Three Phase Commit coordination for
- * {@link DOMDataWriteTransaction} transactions.
- *
- * Implementations are responsible for executing implementation of three-phase
- * commit protocol on supplied {@link DOMStoreThreePhaseCommitCohort}s.
- *
- *
- */
-public interface DOMDataCommitExecutor {
-
-    /**
-     * Submits supplied transaction to be executed in context of provided
-     * cohorts.
-     *
-     * Transaction is used only as a context, cohorts should be associated with
-     * this transaction.
-     *
-     * @param tx
-     *            Transaction to be used as context for reporting
-     * @param cohort
-     *            DOM Store cohorts representing provided transaction, its
-     *            subtransactions.
-     * @return a CheckedFuture. if commit coordination on cohorts finished successfully,
-     *         nothing is returned from the Future, On failure,
-     *         the Future fails with a {@link TransactionCommitFailedException}.
-     *
-     */
-    CheckedFuture<Void,TransactionCommitFailedException> submit(DOMDataWriteTransaction tx,
-            Iterable<DOMStoreThreePhaseCommitCohort> cohort);
-
-}
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitImplementation.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitImplementation.java
deleted file mode 100644 (file)
index 2f2b6e5..0000000
+++ /dev/null
@@ -1,41 +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 org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import com.google.common.util.concurrent.CheckedFuture;
-
-/**
- *
- * Implementation prototype of commit method for
- * {@link DOMForwardedWriteTransaction}.
- *
- */
-public interface DOMDataCommitImplementation {
-
-    /**
-     * User-supplied implementation of {@link DOMDataWriteTransaction#submit()}
-     * for transaction.
-     *
-     * Callback invoked when {@link DOMDataWriteTransaction#submit()} is invoked
-     * on transaction created by this factory.
-     *
-     * @param transaction
-     *            Transaction on which {@link DOMDataWriteTransaction#commit()}
-     *            was invoked.
-     * @param cohorts
-     *            Iteration of cohorts for subtransactions associated with
-     *            commited transaction.
-     *
-     */
-    CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
-            final Iterable<DOMStoreThreePhaseCommitCohort> cohorts);
-}
-
index 662d48a..833d60c 100644 (file)
@@ -37,7 +37,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 final class DOMForwardedReadWriteTransaction extends DOMForwardedWriteTransaction<DOMStoreReadWriteTransaction> implements DOMDataReadWriteTransaction {
     protected DOMForwardedReadWriteTransaction(final Object identifier,
             final Map<LogicalDatastoreType, DOMStoreReadWriteTransaction> backingTxs,
-            final DOMDataCommitImplementation commitImpl) {
+            final AbstractDOMForwardedTransactionFactory<?> commitImpl) {
         super(identifier, backingTxs, commitImpl);
     }
 
index 8c84af1..45e18ff 100644 (file)
@@ -51,8 +51,8 @@ import org.slf4j.LoggerFactory;
 class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
         AbstractDOMForwardedCompositeTransaction<LogicalDatastoreType, T> implements DOMDataWriteTransaction {
     @SuppressWarnings("rawtypes")
-    private static final AtomicReferenceFieldUpdater<DOMForwardedWriteTransaction, DOMDataCommitImplementation> IMPL_UPDATER =
-            AtomicReferenceFieldUpdater.newUpdater(DOMForwardedWriteTransaction.class, DOMDataCommitImplementation.class, "commitImpl");
+    private static final AtomicReferenceFieldUpdater<DOMForwardedWriteTransaction, AbstractDOMForwardedTransactionFactory> IMPL_UPDATER =
+            AtomicReferenceFieldUpdater.newUpdater(DOMForwardedWriteTransaction.class, AbstractDOMForwardedTransactionFactory.class, "commitImpl");
     @SuppressWarnings("rawtypes")
     private static final AtomicReferenceFieldUpdater<DOMForwardedWriteTransaction, Future> FUTURE_UPDATER =
             AtomicReferenceFieldUpdater.newUpdater(DOMForwardedWriteTransaction.class, Future.class, "commitFuture");
@@ -64,7 +64,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
      * the transaction is running -- which we flip atomically using
      * {@link #IMPL_UPDATER}.
      */
-    private volatile DOMDataCommitImplementation commitImpl;
+    private volatile AbstractDOMForwardedTransactionFactory<?> commitImpl;
 
     /**
      * Future task of transaction commit. It starts off as null, but is
@@ -79,7 +79,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
     private volatile Future<?> commitFuture;
 
     protected DOMForwardedWriteTransaction(final Object identifier,
-            final Map<LogicalDatastoreType, T> backingTxs, final DOMDataCommitImplementation commitImpl) {
+            final Map<LogicalDatastoreType, T> backingTxs, final AbstractDOMForwardedTransactionFactory<?> commitImpl) {
         super(identifier, backingTxs);
         this.commitImpl = Preconditions.checkNotNull(commitImpl, "commitImpl must not be null.");
     }
@@ -104,7 +104,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
 
     @Override
     public boolean cancel() {
-        final DOMDataCommitImplementation impl = IMPL_UPDATER.getAndSet(this, null);
+        final AbstractDOMForwardedTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
         if (impl != null) {
             LOG.trace("Transaction {} cancelled before submit", getIdentifier());
             FUTURE_UPDATER.lazySet(this, CANCELLED_FUTURE);
@@ -121,6 +121,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
         return future.cancel(false);
     }
 
+    @Deprecated
     @Override
     public ListenableFuture<RpcResult<TransactionStatus>> commit() {
         return AbstractDataTransaction.convertToLegacyCommitFuture(submit());
@@ -128,7 +129,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
 
     @Override
     public CheckedFuture<Void, TransactionCommitFailedException> submit() {
-        final DOMDataCommitImplementation impl = IMPL_UPDATER.getAndSet(this, null);
+        final AbstractDOMForwardedTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
         checkRunning(impl);
 
         final Collection<T> txns = getSubtransactions();
@@ -144,7 +145,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
         return ret;
     }
 
-    private void checkRunning(final DOMDataCommitImplementation impl) {
+    private void checkRunning(final AbstractDOMForwardedTransactionFactory<?> impl) {
         Preconditions.checkState(impl != null, "Transaction %s is no longer running", getIdentifier());
     }
 }
@@ -11,9 +11,12 @@ import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
+import java.util.Map;
 import java.util.concurrent.RejectedExecutionException;
+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.sal.core.spi.data.DOMStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.yangtools.util.DurationStatisticsTracker;
 import org.opendaylight.yangtools.util.concurrent.MappingCheckedFuture;
@@ -21,22 +24,18 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- *
  * Implementation of blocking three phase commit coordinator, which which
  * supports coordination on multiple {@link DOMStoreThreePhaseCommitCohort}.
  *
- * This implementation does not support cancelation of commit,
+ * This implementation does not support cancellation of commit,
  *
  * In order to advance to next phase of three phase commit all subtasks of
  * previous step must be finish.
  *
  * This executor does not have an upper bound on subtask timeout.
- *
- *
  */
-public class DOMDataCommitCoordinatorImpl implements DOMDataCommitExecutor {
-
-    private static final Logger LOG = LoggerFactory.getLogger(DOMDataCommitCoordinatorImpl.class);
+public class SerializedDOMDataBroker extends AbstractDOMDataBroker {
+    private static final Logger LOG = LoggerFactory.getLogger(SerializedDOMDataBroker.class);
     private final DurationStatisticsTracker commitStatsTracker = DurationStatisticsTracker.createConcurrent();
     private final ListeningExecutorService executor;
 
@@ -47,7 +46,8 @@ public class DOMDataCommitCoordinatorImpl implements DOMDataCommitExecutor {
      *
      * @param executor
      */
-    public DOMDataCommitCoordinatorImpl(final ListeningExecutorService executor) {
+    public SerializedDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, final ListeningExecutorService executor) {
+        super(datastores);
         this.executor = Preconditions.checkNotNull(executor, "executor must not be null.");
     }
 
@@ -56,7 +56,7 @@ public class DOMDataCommitCoordinatorImpl implements DOMDataCommitExecutor {
     }
 
     @Override
-    public CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
+    protected CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
             final Iterable<DOMStoreThreePhaseCommitCohort> cohorts) {
         Preconditions.checkArgument(transaction != null, "Transaction must not be null.");
         Preconditions.checkArgument(cohorts != null, "Cohorts must not be null.");
index eb51db2..2f02f98 100644 (file)
@@ -44,7 +44,7 @@ public class DOMBrokerPerformanceTest {
     }
 
     private SchemaContext schemaContext;
-    private DOMDataBrokerImpl domBroker;
+    private AbstractDOMDataBroker domBroker;
 
     private static <V> V measure(final String name, final Callable<V> callable) throws Exception {
         // TODO Auto-generated method stub
@@ -72,7 +72,7 @@ public class DOMBrokerPerformanceTest {
                 .put(OPERATIONAL, operStore) //
                 .build();
         ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
-        domBroker = new DOMDataBrokerImpl(stores, executor);
+        domBroker = new SerializedDOMDataBroker(stores, executor);
     }
 
     @Test
index 80c4201..c1d301c 100644 (file)
@@ -48,7 +48,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 public class DOMBrokerTest {
 
     private SchemaContext schemaContext;
-    private DOMDataBrokerImpl domBroker;
+    private AbstractDOMDataBroker domBroker;
     private ListeningExecutorService executor;
     private ExecutorService futureExecutor;
     private CommitExecutorService commitExecutor;
@@ -74,7 +74,7 @@ public class DOMBrokerTest {
         futureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(1, 5, "FCB");
         executor = new DeadlockDetectingListeningExecutorService(commitExecutor,
                 TransactionCommitDeadlockException.DEADLOCK_EXCEPTION_SUPPLIER, futureExecutor);
-        domBroker = new DOMDataBrokerImpl(stores, executor);
+        domBroker = new SerializedDOMDataBroker(stores, executor);
     }
 
     @After
index 25d7df1..efc461a 100644 (file)
@@ -10,10 +10,18 @@ package org.opendaylight.controller.md.sal.dom.broker.impl;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.util.concurrent.CheckedFuture;
+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 com.google.common.util.concurrent.SettableFuture;
+import com.google.common.util.concurrent.Uninterruptibles;
 import java.util.Arrays;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.SynchronousQueue;
@@ -27,15 +35,12 @@ import org.junit.Test;
 import org.mockito.InOrder;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
+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.store.impl.InMemoryDOMDataStore;
+import org.opendaylight.controller.sal.core.spi.data.DOMStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import com.google.common.util.concurrent.CheckedFuture;
-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.SettableFuture;
-import com.google.common.util.concurrent.Uninterruptibles;
 
 /**
  * Unit tests for DOMConcurrentDataCommitCoordinator.
@@ -49,12 +54,16 @@ public class DOMConcurrentDataCommitCoordinatorTest {
     private final DOMStoreThreePhaseCommitCohort mockCohort2 = mock(DOMStoreThreePhaseCommitCohort.class);
     private final ThreadPoolExecutor futureExecutor =
             new ThreadPoolExecutor(0, 1, 5, TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
-    private final DOMConcurrentDataCommitCoordinator coordinator =
-            new DOMConcurrentDataCommitCoordinator(futureExecutor);
+    private ConcurrentDOMDataBroker coordinator;
 
     @Before
     public void setup() {
         doReturn("tx").when(transaction).getIdentifier();
+
+        DOMStore store = new InMemoryDOMDataStore("OPER",
+            MoreExecutors.sameThreadExecutor());
+
+        coordinator = new ConcurrentDOMDataBroker(ImmutableMap.of(LogicalDatastoreType.OPERATIONAL, store), futureExecutor);
     }
 
     @After
@@ -76,7 +85,7 @@ public class DOMConcurrentDataCommitCoordinatorTest {
         final CountDownLatch asyncCanCommitContinue = new CountDownLatch(1);
         Answer<ListenableFuture<Boolean>> asyncCanCommit = new Answer<ListenableFuture<Boolean>>() {
             @Override
-            public ListenableFuture<Boolean> answer(InvocationOnMock invocation) {
+            public ListenableFuture<Boolean> answer(final InvocationOnMock invocation) {
                 final SettableFuture<Boolean> future = SettableFuture.create();
                 if(doAsync) {
                     new Thread() {
@@ -110,12 +119,12 @@ public class DOMConcurrentDataCommitCoordinatorTest {
         final AtomicReference<Throwable> caughtEx = new AtomicReference<>();
         Futures.addCallback(future, new FutureCallback<Void>() {
             @Override
-            public void onSuccess(Void result) {
+            public void onSuccess(final Void result) {
                 doneLatch.countDown();
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(final Throwable t) {
                 caughtEx.set(t);
                 doneLatch.countDown();
             }
@@ -158,8 +167,8 @@ public class DOMConcurrentDataCommitCoordinatorTest {
         assertFailure(future, null, mockCohort1, mockCohort2, mockCohort3);
     }
 
-    private void assertFailure(CheckedFuture<Void, TransactionCommitFailedException> future,
-            Exception expCause, DOMStoreThreePhaseCommitCohort... mockCohorts)
+    private void assertFailure(final CheckedFuture<Void, TransactionCommitFailedException> future,
+            final Exception expCause, final DOMStoreThreePhaseCommitCohort... mockCohorts)
                     throws Exception {
         try {
             future.checkedGet(5, TimeUnit.SECONDS);
index 17f477b..03d39a2 100644 (file)
@@ -37,7 +37,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 public class DOMTransactionChainTest {
 
     private SchemaContext schemaContext;
-    private DOMDataBrokerImpl domBroker;
+    private AbstractDOMDataBroker domBroker;
 
     @Before
     public void setupStore() {
@@ -54,7 +54,7 @@ public class DOMTransactionChainTest {
                 .build();
 
         ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
-        domBroker = new DOMDataBrokerImpl(stores, executor);
+        domBroker = new SerializedDOMDataBroker(stores, executor);
     }
 
     @Test
index 3070499..de7d33e 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompati
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
@@ -68,7 +68,7 @@ public class DataBrokerTestCustomizer {
     }
 
     public DOMDataBroker createDOMDataBroker() {
-        return new DOMDataBrokerImpl(getDatastores(), getCommitCoordinatorExecutor());
+        return new SerializedDOMDataBroker(getDatastores(), getCommitCoordinatorExecutor());
     }
 
     public ListeningExecutorService getCommitCoordinatorExecutor() {

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