From a7fa4e6badc5d5d3f402bedb72edebbf5c12bd2b Mon Sep 17 00:00:00 2001 From: David Suarez Date: Tue, 5 Sep 2017 20:50:00 +0200 Subject: [PATCH] Fix checkstyle issues to enforce it Fix checkstyle issues to enforce it. Note: I had to replace the calls to MoreExecutors.sameThread() since the module didn't compile locally. That method [1] is deprecated anyway. [1] https://google.github.io/guava/releases/19.0/api/docs/com/google/common/util/concurrent/MoreExecutors.html#sameThreadExecutor() Change-Id: I4263cadc0748065b20b425d6860fe36569d913b1 Signed-off-by: David Suarez --- .../md-sal/benchmark-data-store/pom.xml | 16 ++++--- ...MemoryBrokerWriteTransactionBenchmark.java | 28 ++++++++----- ...oryDatastoreWriteTransactionBenchmark.java | 10 +++-- ...ractInMemoryWriteTransactionBenchmark.java | 42 ++++++++++--------- .../dom/store/benchmark/BenchmarkModel.java | 6 ++- ...MemoryBrokerWriteTransactionBenchmark.java | 7 ++-- ...toreWithSameThreadedExecutorBenchmark.java | 26 +++++++----- ...oryDataStoreWriteTransactionBenchmark.java | 21 ++++++---- 8 files changed, 92 insertions(+), 64 deletions(-) diff --git a/opendaylight/md-sal/benchmark-data-store/pom.xml b/opendaylight/md-sal/benchmark-data-store/pom.xml index 2ca1267185..d08e9b3c7e 100644 --- a/opendaylight/md-sal/benchmark-data-store/pom.xml +++ b/opendaylight/md-sal/benchmark-data-store/pom.xml @@ -6,15 +6,14 @@ 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 --> - + 4.0.0 org.opendaylight.odlparent odlparent 2.0.4 - + @@ -74,6 +73,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html + + org.apache.maven.plugins + maven-checkstyle-plugin + + checkstyle.violationSeverity=error + + org.codehaus.mojo exec-maven-plugin @@ -82,7 +88,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html java -classpath - + org.openjdk.jmh.Main .* diff --git a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryBrokerWriteTransactionBenchmark.java b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryBrokerWriteTransactionBenchmark.java index 2219c2a4da..04298a66fe 100644 --- a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryBrokerWriteTransactionBenchmark.java +++ b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryBrokerWriteTransactionBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 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, @@ -18,15 +18,17 @@ import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; /** + * Abstract class to handle transaction benchmarks. + * * @author Lukas Sedlak */ -public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends AbstractInMemoryWriteTransactionBenchmark { +public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark + extends AbstractInMemoryWriteTransactionBenchmark { protected SerializedDOMDataBroker domBroker; protected void initTestNode() throws Exception { - final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH) - .build(); + final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH).build(); DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); writeTx.put(LogicalDatastoreType.OPERATIONAL, testPath, provideOuterListNode()); @@ -40,7 +42,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) { - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey], + OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); } writeTx.submit().get(); @@ -52,7 +55,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark() throws Exception { for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey], + OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); writeTx.submit().get(); } @@ -64,7 +68,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark() throws Exception { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) { - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey], + OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); } writeTx.submit().get(); @@ -76,7 +81,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark() throws Exception { for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey], + OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); writeTx.submit().get(); } } @@ -87,7 +93,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write10KSingleNodeWithTenInnerItemsInOneCommitBenchmark() throws Exception { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) { - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey], OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey], + OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); } writeTx.submit().get(); } @@ -98,7 +105,8 @@ public abstract class AbstractInMemoryBrokerWriteTransactionBenchmark extends Ab public void write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark() throws Exception { for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) { DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction(); - writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey], OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); + writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey], + OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); writeTx.submit().get(); } } diff --git a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryDatastoreWriteTransactionBenchmark.java b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryDatastoreWriteTransactionBenchmark.java index 80bb50375f..00925a562d 100644 --- a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryDatastoreWriteTransactionBenchmark.java +++ b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryDatastoreWriteTransactionBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 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, @@ -17,15 +17,17 @@ import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Warmup; /** + * Abstract class for in-memory Datastore transaction benchmarks. + * * @author Lukas Sedlak */ -public abstract class AbstractInMemoryDatastoreWriteTransactionBenchmark extends AbstractInMemoryWriteTransactionBenchmark { +public abstract class AbstractInMemoryDatastoreWriteTransactionBenchmark + extends AbstractInMemoryWriteTransactionBenchmark { protected InMemoryDOMDataStore domStore; protected void initTestNode() throws Exception { - final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH) - .build(); + final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH).build(); DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction(); writeTx.write(testPath, provideOuterListNode()); diff --git a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryWriteTransactionBenchmark.java b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryWriteTransactionBenchmark.java index 6c256eb7af..a2414d71ef 100644 --- a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryWriteTransactionBenchmark.java +++ b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/AbstractInMemoryWriteTransactionBenchmark.java @@ -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, @@ -31,8 +31,7 @@ public abstract class AbstractInMemoryWriteTransactionBenchmark { for (int outerListKey = 0; outerListKey < outerListPathsCount; ++outerListKey) { paths[outerListKey] = YangInstanceIdentifier.builder(BenchmarkModel.OUTER_LIST_PATH) - .nodeWithKey(BenchmarkModel.OUTER_LIST_QNAME, BenchmarkModel.ID_QNAME, outerListKey) - .build(); + .nodeWithKey(BenchmarkModel.OUTER_LIST_QNAME, BenchmarkModel.ID_QNAME, outerListKey).build(); } return paths; } @@ -46,40 +45,43 @@ public abstract class AbstractInMemoryWriteTransactionBenchmark { private static MapNode initInnerListItems(final int count) { final CollectionNodeBuilder mapEntryBuilder = ImmutableNodes - .mapNodeBuilder(BenchmarkModel.INNER_LIST_QNAME); + .mapNodeBuilder(BenchmarkModel.INNER_LIST_QNAME); for (int i = 1; i <= count; ++i) { mapEntryBuilder - .withChild(ImmutableNodes.mapEntry(BenchmarkModel.INNER_LIST_QNAME, BenchmarkModel.NAME_QNAME, i)); + .withChild(ImmutableNodes.mapEntry(BenchmarkModel.INNER_LIST_QNAME, BenchmarkModel.NAME_QNAME, i)); } return mapEntryBuilder.build(); } - protected static final NormalizedNode[] OUTER_LIST_ONE_ITEM_INNER_LIST = initOuterListItems(OUTER_LIST_100K, ONE_ITEM_INNER_LIST); - protected static final NormalizedNode[] OUTER_LIST_TWO_ITEM_INNER_LIST = initOuterListItems(OUTER_LIST_50K, TWO_ITEM_INNER_LIST); - protected static final NormalizedNode[] OUTER_LIST_TEN_ITEM_INNER_LIST = initOuterListItems(OUTER_LIST_10K, TEN_ITEM_INNER_LIST); + protected static final NormalizedNode[] OUTER_LIST_ONE_ITEM_INNER_LIST = initOuterListItems(OUTER_LIST_100K, + ONE_ITEM_INNER_LIST); + protected static final NormalizedNode[] OUTER_LIST_TWO_ITEM_INNER_LIST = initOuterListItems(OUTER_LIST_50K, + TWO_ITEM_INNER_LIST); + protected static final NormalizedNode[] OUTER_LIST_TEN_ITEM_INNER_LIST = initOuterListItems(OUTER_LIST_10K, + TEN_ITEM_INNER_LIST); - private static NormalizedNode[] initOuterListItems(final int outerListItemsCount, final MapNode innerList) { - final NormalizedNode[] outerListItems = new NormalizedNode[outerListItemsCount]; + private static NormalizedNode[] initOuterListItems(final int outerListItemsCount, final MapNode innerList) { + final NormalizedNode[] outerListItems = new NormalizedNode[outerListItemsCount]; for (int i = 0; i < outerListItemsCount; ++i) { int outerListKey = i; - outerListItems[i] = ImmutableNodes.mapEntryBuilder(BenchmarkModel.OUTER_LIST_QNAME, BenchmarkModel.ID_QNAME, outerListKey) - .withChild(innerList).build(); + outerListItems[i] = ImmutableNodes + .mapEntryBuilder(BenchmarkModel.OUTER_LIST_QNAME, BenchmarkModel.ID_QNAME, outerListKey) + .withChild(innerList).build(); } return outerListItems; } protected SchemaContext schemaContext; - abstract public void setUp() throws Exception; - abstract public void tearDown(); + + public abstract void setUp() throws Exception; + + public abstract void tearDown(); protected static DataContainerChild provideOuterListNode() { - return ImmutableContainerNodeBuilder - .create() - .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BenchmarkModel.TEST_QNAME)) - .withChild( - ImmutableNodes.mapNodeBuilder(BenchmarkModel.OUTER_LIST_QNAME) - .build()).build(); + return ImmutableContainerNodeBuilder.create() + .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BenchmarkModel.TEST_QNAME)) + .withChild(ImmutableNodes.mapNodeBuilder(BenchmarkModel.OUTER_LIST_QNAME).build()).build(); } } diff --git a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/BenchmarkModel.java b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/BenchmarkModel.java index 7424adc259..d2d3b51048 100644 --- a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/BenchmarkModel.java +++ b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/BenchmarkModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 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, @@ -33,11 +33,13 @@ public final class BenchmarkModel { public static final QName ID_QNAME = QName.create(TEST_QNAME, "id"); public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name"); private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang"; - public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME); public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build(); + private BenchmarkModel() { + } + private static InputStream getInputStream() { return BenchmarkModel.class.getResourceAsStream(DATASTORE_TEST_YANG); } diff --git a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryBrokerWriteTransactionBenchmark.java b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryBrokerWriteTransactionBenchmark.java index e6a1642703..7c0b4b7d07 100644 --- a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryBrokerWriteTransactionBenchmark.java +++ b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryBrokerWriteTransactionBenchmark.java @@ -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, @@ -37,9 +37,10 @@ public class InMemoryBrokerWriteTransactionBenchmark extends AbstractInMemoryBro @Setup(Level.Trial) @Override public void setUp() throws Exception { - ListeningExecutorService dsExec = MoreExecutors.sameThreadExecutor(); + ListeningExecutorService dsExec = MoreExecutors.newDirectExecutorService(); 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); InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", dsExec); diff --git a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryDataStoreWithSameThreadedExecutorBenchmark.java b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryDataStoreWithSameThreadedExecutorBenchmark.java index 330c947943..037058848e 100644 --- a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryDataStoreWithSameThreadedExecutorBenchmark.java +++ b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryDataStoreWithSameThreadedExecutorBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 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, @@ -11,19 +11,20 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; import org.opendaylight.yangtools.util.concurrent.SpecialExecutors; -import org.openjdk.jmh.annotations.Level; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.TearDown; -import org.openjdk.jmh.annotations.Fork; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.TearDown; /** - * Benchmark for testing of performance of write operations for InMemoryDataStore. The instance - * of benchmark creates InMemoryDataStore with Data Change Listener Executor Service as Blocking Bounded Fast Thread Pool + * Benchmark for testing of performance of write operations for + * InMemoryDataStore. The instance of benchmark creates InMemoryDataStore with + * Data Change Listener Executor Service as Blocking Bounded Fast Thread Pool * and DOM Store Executor Service as Same Thread Executor. * * @author Lukas Sedlak @@ -32,16 +33,18 @@ import org.openjdk.jmh.annotations.OutputTimeUnit; @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) @Fork(1) -public class InMemoryDataStoreWithSameThreadedExecutorBenchmark extends AbstractInMemoryDatastoreWriteTransactionBenchmark { +public class InMemoryDataStoreWithSameThreadedExecutorBenchmark + extends AbstractInMemoryDatastoreWriteTransactionBenchmark { private static final int MAX_DATA_CHANGE_EXECUTOR_POOL_SIZE = 20; private static final int MAX_DATA_CHANGE_EXECUTOR_QUEUE_SIZE = 1000; + @Override @Setup(Level.Trial) public void setUp() throws Exception { final String name = "DS_BENCHMARK"; final ExecutorService dataChangeListenerExecutor = SpecialExecutors.newBlockingBoundedFastThreadPool( - MAX_DATA_CHANGE_EXECUTOR_POOL_SIZE, MAX_DATA_CHANGE_EXECUTOR_QUEUE_SIZE, name + "-DCL"); + MAX_DATA_CHANGE_EXECUTOR_POOL_SIZE, MAX_DATA_CHANGE_EXECUTOR_QUEUE_SIZE, name + "-DCL"); domStore = new InMemoryDOMDataStore("SINGLE_THREADED_DS_BENCHMARK", dataChangeListenerExecutor); schemaContext = BenchmarkModel.createTestContext(); @@ -49,6 +52,7 @@ public class InMemoryDataStoreWithSameThreadedExecutorBenchmark extends Abstract initTestNode(); } + @Override @TearDown public void tearDown() { schemaContext = null; diff --git a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryDataStoreWriteTransactionBenchmark.java b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryDataStoreWriteTransactionBenchmark.java index 930ceaf07d..fee7eca788 100644 --- a/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryDataStoreWriteTransactionBenchmark.java +++ b/opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryDataStoreWriteTransactionBenchmark.java @@ -7,23 +7,24 @@ */ package org.opendaylight.controller.md.sal.dom.store.benchmark; -import com.google.common.util.concurrent.MoreExecutors; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; -import org.openjdk.jmh.annotations.Fork; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; /** - * Benchmark for testing of performance of write operations for InMemoryDataStore. The instance - * of benchmark creates InMemoryDataStore with Data Change Listener Executor Service as Same Thread Executor - * and DOM Store Executor Service as Same Thread Executor. + * Benchmark for testing of performance of write operations for + * InMemoryDataStore. The instance of benchmark creates InMemoryDataStore with + * Data Change Listener Executor Service as Same Thread Executor and DOM Store + * Executor Service as Same Thread Executor. * * @author Lukas Sedlak */ @@ -33,14 +34,16 @@ import org.openjdk.jmh.annotations.TearDown; @Fork(1) public class InMemoryDataStoreWriteTransactionBenchmark extends AbstractInMemoryDatastoreWriteTransactionBenchmark { + @Override @Setup(Level.Trial) public void setUp() throws Exception { - domStore = new InMemoryDOMDataStore("SINGLE_THREADED_DS_BENCHMARK", MoreExecutors.sameThreadExecutor()); + domStore = new InMemoryDOMDataStore("SINGLE_THREADED_DS_BENCHMARK", Executors.newSingleThreadExecutor()); schemaContext = BenchmarkModel.createTestContext(); domStore.onGlobalContextUpdated(schemaContext); initTestNode(); } + @Override @TearDown public void tearDown() { schemaContext = null; -- 2.36.6