goiri commented on code in PR #6655:
URL: https://github.com/apache/hadoop/pull/6655#discussion_r1597672487


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java:
##########
@@ -404,6 +404,28 @@ public static void waitFor(final Supplier<Boolean> check,
     }
   }
 
+  /**
+   * Wait at least {@code atLeastWaitForMillis} from start to end of the test.
+   *
+   * @param check the test to perform.
+   * @param atLeastWaitForMillis the minimum waiting time from the beginning
+   * to the end of the test.
+   * @throws InterruptedException if the method is interrupted while waiting.
+   */
+  public static <T> T atLeastWaitFor(final Supplier<T> check,
+      long atLeastWaitForMillis) throws InterruptedException {
+    if (atLeastWaitForMillis < 0) {
+      atLeastWaitForMillis = 0;
+    }
+    long st = Time.monotonicNow();
+    T result = check.get();

Review Comment:
   I don't think you are waiting at least, you are getting the value and then 
waiting.
   Either change the method name to execute and wait or actually wait after the 
sleep.



-- 
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.

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to