Migrate to MD-SAL APIs
[controller.git] / opendaylight / md-sal / benchmark-data-store / src / main / java / org / opendaylight / controller / md / sal / dom / store / benchmark / InMemoryBrokerWriteTransactionBenchmark.java
index a46a6d1e79a21fc6b1811b762f11d0ec41515148..a0a096ed33cbc256c79d3657bb777b9d336a8c90 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 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,
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -14,10 +14,10 @@ import java.util.Map;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 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.store.impl.InMemoryDOMDataStore;
-import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
+import org.opendaylight.mdsal.dom.spi.store.DOMStore;
+import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore;
 import org.openjdk.jmh.annotations.BenchmarkMode;
 import org.openjdk.jmh.annotations.Fork;
 import org.openjdk.jmh.annotations.Level;
 import org.openjdk.jmh.annotations.BenchmarkMode;
 import org.openjdk.jmh.annotations.Fork;
 import org.openjdk.jmh.annotations.Level;
@@ -37,19 +37,18 @@ public class InMemoryBrokerWriteTransactionBenchmark extends AbstractInMemoryBro
     @Setup(Level.Trial)
     @Override
     public void setUp() throws Exception {
     @Setup(Level.Trial)
     @Override
     public void setUp() throws Exception {
-        ListeningExecutorService dsExec = MoreExecutors.sameThreadExecutor();
+        ListeningExecutorService dsExec = MoreExecutors.newDirectExecutorService();
         executor = MoreExecutors.listeningDecorator(
         executor = MoreExecutors.listeningDecorator(
-            MoreExecutors.getExitingExecutorService((ThreadPoolExecutor)Executors.newFixedThreadPool(1), 1L, TimeUnit.SECONDS));
+                MoreExecutors.getExitingExecutorService((ThreadPoolExecutor) Executors.newFixedThreadPool(1), 1L,
+                        TimeUnit.SECONDS));
 
 
-        InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", dsExec,
-            MoreExecutors.sameThreadExecutor());
-        InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", dsExec,
-            MoreExecutors.sameThreadExecutor());
+        InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", dsExec);
+        InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", dsExec);
         Map<LogicalDatastoreType, DOMStore> datastores = ImmutableMap.of(
             LogicalDatastoreType.OPERATIONAL, (DOMStore)operStore,
             LogicalDatastoreType.CONFIGURATION, configStore);
 
         Map<LogicalDatastoreType, DOMStore> datastores = ImmutableMap.of(
             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);
         schemaContext = BenchmarkModel.createTestContext();
         configStore.onGlobalContextUpdated(schemaContext);
         operStore.onGlobalContextUpdated(schemaContext);