xyuanlu commented on code in PR #2458:
URL: https://github.com/apache/helix/pull/2458#discussion_r1178215719


##########
helix-core/src/test/java/org/apache/helix/TestHelper.java:
##########
@@ -803,19 +803,15 @@ public interface Verifier {
   }
 
   public static boolean verify(Verifier verifier, long timeout) throws 
Exception {
-    long start = System.currentTimeMillis();
-    do {
-      boolean result = verifier.verify();
-      boolean isTimedout = (System.currentTimeMillis() - start) > timeout;
-      if (result || isTimedout) {
-        if (isTimedout && !result) {
-          LOG.error("verifier time out, consider try longer timeout, stack 
trace{}",
-              Arrays.asList(Thread.currentThread().getStackTrace()));
-        }
-        return result;
-      }
-      Thread.sleep(50);
-    } while (true);
+    try {
+      with().pollInterval(50, TimeUnit.MILLISECONDS).atMost(timeout, 
TimeUnit.MILLISECONDS).await()
+          .until(verifier::verify);
+      return verifier.verify();
+    } catch (Exception ex) {
+      LOG.error("verifier time out, consider try longer timeout, stack 
trace{}",

Review Comment:
   Thanks for explain. I feel like there is no need to log here. Exception will 
print stack trace. 



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