janhoy commented on code in PR #3937:
URL: https://github.com/apache/solr/pull/3937#discussion_r2617384766


##########
solr/solrj/src/java/org/apache/solr/common/util/RetryUtil.java:
##########
@@ -84,12 +144,32 @@ public static void retryUntil(
     throw new SolrException(ErrorCode.SERVER_ERROR, errorMessage);
   }
 
+  /**
+   * Retries a command until it returns {@code true} or the timeout is reached.
+   *
+   * <p>The command is executed repeatedly until it returns {@code true} or 
the timeout expires. If
+   * the command returns {@code false} and there is time remaining, the method 
sleeps for {@code
+   * intervalms} milliseconds before retrying. If the timeout is reached 
before the command
+   * succeeds, a {@link SolrException} is thrown.
+   *
+   * @param timeoutms maximum time to retry in milliseconds
+   * @param intervalms wait interval between retries in milliseconds
+   * @param cmd the command to execute
+   * @throws SolrException if the timeout is reached before the command 
succeeds, or if the thread
+   *     is interrupted while sleeping between retries
+   */
   public static void retryOnBoolean(long timeoutms, long intervalms, 
BooleanRetryCmd cmd) {
     long timeout =
         System.nanoTime() + TimeUnit.NANOSECONDS.convert(timeoutms, 
TimeUnit.MILLISECONDS);
     while (true) {
       boolean resp = cmd.execute();
       if (!resp && System.nanoTime() < timeout) {
+        try {

Review Comment:
   Nice utitlity, can help us stabilize some more tests I imagine.



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