This is an automated email from the ASF dual-hosted git repository.

jbarrett 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 4b172bc  GEODE-6785: Retry time - system property read optimized 
(#3662)
4b172bc is described below

commit 4b172bcd9c149f4ddb2e10a4413215d8d157a2e6
Author: mivanac <[email protected]>
AuthorDate: Wed Jun 5 19:29:51 2019 +0200

    GEODE-6785: Retry time - system property read optimized (#3662)
---
 .../internal/util/concurrent/StoppableCountDownLatch.java     |  7 ++++---
 .../internal/util/concurrent/StoppableCountDownLatchTest.java | 11 -----------
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/util/concurrent/StoppableCountDownLatch.java
 
b/geode-core/src/main/java/org/apache/geode/internal/util/concurrent/StoppableCountDownLatch.java
index 6c6576a..a24438e 100644
--- 
a/geode-core/src/main/java/org/apache/geode/internal/util/concurrent/StoppableCountDownLatch.java
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/util/concurrent/StoppableCountDownLatch.java
@@ -32,6 +32,9 @@ public class StoppableCountDownLatch {
   static final String RETRY_TIME_MILLIS_PROPERTY = GEMFIRE_PREFIX + 
"stoppable-retry-interval";
   static final long RETRY_TIME_MILLIS_DEFAULT = 2000;
 
+  static final long RETRY_TIME_NANOS = MILLISECONDS.toNanos(
+      Long.getLong(RETRY_TIME_MILLIS_PROPERTY, RETRY_TIME_MILLIS_DEFAULT));
+
   private final CountDownLatch delegate;
 
   private final CancelCriterion stopper;
@@ -51,9 +54,7 @@ public class StoppableCountDownLatch {
    * @throws IllegalArgumentException if {@code count} is negative
    */
   public StoppableCountDownLatch(final CancelCriterion stopper, final int 
count) {
-    this(stopper, count,
-        MILLISECONDS.toNanos(Long.getLong(RETRY_TIME_MILLIS_PROPERTY, 
RETRY_TIME_MILLIS_DEFAULT)),
-        System::nanoTime);
+    this(stopper, count, RETRY_TIME_NANOS, System::nanoTime);
   }
 
   StoppableCountDownLatch(final CancelCriterion stopper, final int count,
diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/util/concurrent/StoppableCountDownLatchTest.java
 
b/geode-core/src/test/java/org/apache/geode/internal/util/concurrent/StoppableCountDownLatchTest.java
index 9419e11..9a1561f 100644
--- 
a/geode-core/src/test/java/org/apache/geode/internal/util/concurrent/StoppableCountDownLatchTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/internal/util/concurrent/StoppableCountDownLatchTest.java
@@ -17,7 +17,6 @@ package org.apache.geode.internal.util.concurrent;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
 import static 
org.apache.geode.internal.util.concurrent.StoppableCountDownLatch.RETRY_TIME_MILLIS_DEFAULT;
-import static 
org.apache.geode.internal.util.concurrent.StoppableCountDownLatch.RETRY_TIME_MILLIS_PROPERTY;
 import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
 import static org.apache.geode.test.awaitility.GeodeAwaitility.getTimeout;
 import static org.assertj.core.api.Assertions.assertThat;
@@ -71,16 +70,6 @@ public class StoppableCountDownLatchTest {
   }
 
   @Test
-  public void defaultRetryIntervalNanosIsOverriddenBySystemProperty() {
-    long theRetryTimeMillis = 42;
-    System.setProperty(RETRY_TIME_MILLIS_PROPERTY, 
String.valueOf(theRetryTimeMillis));
-
-    StoppableCountDownLatch latch = new StoppableCountDownLatch(stopper, 1);
-
-    
assertThat(NANOSECONDS.toMillis(latch.retryIntervalNanos())).isEqualTo(theRetryTimeMillis);
-  }
-
-  @Test
   public void awaitReturnsAfterCountDown() {
     StoppableCountDownLatch latch =
         new StoppableCountDownLatch(stopper, 1, MILLISECONDS.toNanos(2), 
System::nanoTime);

Reply via email to