adoroszlai commented on code in PR #5923:
URL: https://github.com/apache/ozone/pull/5923#discussion_r1443250643


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java:
##########
@@ -603,4 +610,32 @@ private static void resetPriorities(RaftGroup original, 
RaftClient client) {
       // Not re-thrown in order to keep the main exception, if there is any.
     }
   }
+
+  /**
+   * Similar to {@link JavaUtils#attemptUntilTrue(BooleanSupplier, int, 
TimeDuration, String, Logger)},
+   * but:
+   * <li>takes max. {@link Duration} instead of number of attempts</li>
+   * <li>accepts {@link Duration} instead of {@link TimeDuration} for sleep 
time</li>
+   *
+   * @return true if attempt was successful,
+   * false if wait for condition to become true timed out or was interrupted
+   */
+  public static boolean attemptUntilTrue(BooleanSupplier condition, Duration 
pollInterval, Duration timeout) {

Review Comment:
   We could even get rid of this wrapper if using "number of attempts" is fine.
   
   (600 attempts with 100ms sleep seems to be equivalent to 60s max. wait)



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