From 5402ce5472a493467431cab898afd3841eb31b61 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Sat, 26 Nov 2022 10:19:04 +0100 Subject: [PATCH] Use explicit exceptions in benchmark Sonar does not like Exception, fix the issues reported. Change-Id: I483b4bb04839f577261f4a141ddfc0dd8b90b08a Signed-off-by: Robert Varga --- ...oryDatastoreWriteTransactionBenchmark.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/dom/mdsal-dom-inmemory-datastore-benchmark/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/benchmark/AbstractInMemoryDatastoreWriteTransactionBenchmark.java b/dom/mdsal-dom-inmemory-datastore-benchmark/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/benchmark/AbstractInMemoryDatastoreWriteTransactionBenchmark.java index 7d15db5e91..52c712949a 100644 --- a/dom/mdsal-dom-inmemory-datastore-benchmark/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/benchmark/AbstractInMemoryDatastoreWriteTransactionBenchmark.java +++ b/dom/mdsal-dom-inmemory-datastore-benchmark/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/benchmark/AbstractInMemoryDatastoreWriteTransactionBenchmark.java @@ -7,6 +7,7 @@ */ package org.opendaylight.mdsal.dom.store.inmemory.benchmark; +import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction; import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort; @@ -26,7 +27,7 @@ public abstract class AbstractInMemoryDatastoreWriteTransactionBenchmark protected InMemoryDOMDataStore domStore; - protected void initTestNode() throws Exception { + protected void initTestNode() throws InterruptedException, ExecutionException { final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH).build(); DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction(); writeTx.write(testPath, provideOuterListNode()); @@ -40,7 +41,8 @@ public abstract class AbstractInMemoryDatastoreWriteTransactionBenchmark @Benchmark @Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) - public void write100KSingleNodeWithOneInnerItemInOneCommitBenchmark() throws Exception { + public void write100KSingleNodeWithOneInnerItemInOneCommitBenchmark() + throws InterruptedException, ExecutionException { DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction(); for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) { writeTx.write(OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); @@ -54,7 +56,8 @@ public abstract class AbstractInMemoryDatastoreWriteTransactionBenchmark @Benchmark @Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) - public void write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark() throws Exception { + public void write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark() + throws InterruptedException, ExecutionException { for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) { DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction(); writeTx.write(OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]); @@ -69,7 +72,8 @@ public abstract class AbstractInMemoryDatastoreWriteTransactionBenchmark @Benchmark @Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) - public void write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark() throws Exception { + public void write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark() + throws InterruptedException, ExecutionException { DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction(); for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) { writeTx.write(OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); @@ -83,7 +87,8 @@ public abstract class AbstractInMemoryDatastoreWriteTransactionBenchmark @Benchmark @Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) - public void write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark() throws Exception { + public void write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark() + throws InterruptedException, ExecutionException { for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) { DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction(); writeTx.write(OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]); @@ -97,7 +102,8 @@ public abstract class AbstractInMemoryDatastoreWriteTransactionBenchmark @Benchmark @Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) - public void write10KSingleNodeWithTenInnerItemsInOneCommitBenchmark() throws Exception { + public void write10KSingleNodeWithTenInnerItemsInOneCommitBenchmark() + throws InterruptedException, ExecutionException { DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction(); for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) { writeTx.write(OUTER_LIST_10K_PATHS[outerListKey], OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); @@ -111,7 +117,8 @@ public abstract class AbstractInMemoryDatastoreWriteTransactionBenchmark @Benchmark @Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS) - public void write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark() throws Exception { + public void write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark() + throws InterruptedException, ExecutionException { for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) { DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction(); writeTx.write(OUTER_LIST_10K_PATHS[outerListKey], OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]); -- 2.36.6