hemantk-12 commented on code in PR #5923:
URL: https://github.com/apache/ozone/pull/5923#discussion_r1443264632


##########
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:
   Using "number of attempts" is fine as well. It is equivalent to poll max 
time as you said.
   
   I was thinking if we can get rid of `LambdaTestUtils#await` and 
`GenericTestUtils#waitFor` if we add it into JavaUtils. But it could be future 
improvement and can be done later.
   
   For now, I'm OK if you leave it as it is or use "number of attempts".



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