geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcmellaw...@apache.org
Subject [geode] branch develop updated: GEODE-6488: Fixing QueryMonitor JMH test
Date Wed, 20 Mar 2019 22:01:08 GMT
This is an automated email from the ASF dual-hosted git repository.

mcmellawatt pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 645db96  GEODE-6488: Fixing QueryMonitor JMH test
645db96 is described below

commit 645db96032a523c0b943084d61321f33d99f3779
Author: Ryan McMahon <rmcmahon@pivotal.io>
AuthorDate: Wed Mar 20 13:52:34 2019 -0700

    GEODE-6488: Fixing QueryMonitor JMH test
---
 .../internal/MonitorQueryUnderContentionBenchmark.java | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/geode-core/src/jmh/java/org/apache/geode/cache/query/internal/MonitorQueryUnderContentionBenchmark.java
b/geode-core/src/jmh/java/org/apache/geode/cache/query/internal/MonitorQueryUnderContentionBenchmark.java
index bcb70d1..9c622a2 100644
--- a/geode-core/src/jmh/java/org/apache/geode/cache/query/internal/MonitorQueryUnderContentionBenchmark.java
+++ b/geode-core/src/jmh/java/org/apache/geode/cache/query/internal/MonitorQueryUnderContentionBenchmark.java
@@ -84,7 +84,7 @@ public class MonitorQueryUnderContentionBenchmark {
   private static final int RANDOM_SEED = 151;
 
   private QueryMonitor queryMonitor;
-  private DefaultQuery query;
+  private ExecutionContext queryExecutionContext;
   private Random random;
   private ScheduledThreadPoolExecutor loadGenerationExecutorService;
 
@@ -107,7 +107,7 @@ public class MonitorQueryUnderContentionBenchmark {
 
     random = new Random(RANDOM_SEED);
 
-    query = createDefaultQuery();
+    queryExecutionContext = mock(ExecutionContext.class);
 
     generateLoad(
         loadGenerationExecutorService, () -> startOneFastQuery(loadGenerationExecutorService),
@@ -136,8 +136,8 @@ public class MonitorQueryUnderContentionBenchmark {
   @OutputTimeUnit(TimeUnit.MILLISECONDS)
   // @Warmup we don't warm up because our @Setup warms us up
   public void monitorQuery() {
-    queryMonitor.monitorQueryExecution(query);
-    queryMonitor.stopMonitoringQueryExecution(query);
+    queryMonitor.monitorQueryExecution(queryExecutionContext);
+    queryMonitor.stopMonitoringQueryExecution(queryExecutionContext);
   }
 
   private void generateLoad(final ScheduledExecutorService executorService,
@@ -159,10 +159,10 @@ public class MonitorQueryUnderContentionBenchmark {
   private void startOneSimulatedQuery(ScheduledExecutorService executorService,
       int startDelayRangeMillis, int completeDelayRangeMillis) {
     executorService.schedule(() -> {
-      final DefaultQuery query = createDefaultQuery();
-      queryMonitor.monitorQueryExecution(query);
+      final ExecutionContext queryExecutionContext = mock(ExecutionContext.class);
+      queryMonitor.monitorQueryExecution(queryExecutionContext);
       executorService.schedule(() -> {
-        queryMonitor.stopMonitoringQueryExecution(query);
+        queryMonitor.stopMonitoringQueryExecution(queryExecutionContext);
       },
           gaussianLong(completeDelayRangeMillis),
           TimeUnit.MILLISECONDS);
@@ -174,8 +174,4 @@ public class MonitorQueryUnderContentionBenchmark {
   private long gaussianLong(int range) {
     return (long) (random.nextGaussian() * range);
   }
-
-  private DefaultQuery createDefaultQuery() {
-    return mock(DefaultQuery.class);
-  }
 }


Mime
View raw message