Bill commented on a change in pull request #5743:
URL: https://github.com/apache/geode/pull/5743#discussion_r527147213



##########
File path: geode-common/src/main/java/org/apache/geode/internal/Retry.java
##########
@@ -32,18 +31,21 @@
   interface Timer {
     long nanoTime();
 
-    void sleep(long sleepTime, TimeUnit sleepTimeUnit) throws 
InterruptedException;
+    void sleep(long sleepTimeInNano) throws InterruptedException;
   }
 
-  private static class SteadyTimer implements Timer {
+  static class SteadyTimer implements Timer {
     @Override
     public long nanoTime() {
       return System.nanoTime();
     }
 
     @Override
-    public void sleep(long sleepTime, TimeUnit sleepTimeUnit) throws 
InterruptedException {
-      Thread.sleep(MILLISECONDS.convert(sleepTime, sleepTimeUnit));
+    public void sleep(long sleepTimeInNano) throws InterruptedException {
+      // avoid throwing IllegalArgumentException
+      if (sleepTimeInNano > 0) {
+        Thread.sleep(NANOSECONDS.toMillis(sleepTimeInNano));

Review comment:
       I recommend testing the condition _after_ the conversion to milliseconds 
since e.g. `NANOSECONDS.toMillis(1) == 0`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to