You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/09/01 09:37:18 UTC

[GitHub] [kafka] yashmayya commented on a diff in pull request #12478: KAFKA-13952 fix RetryWithToleranceOperator to respect infinite retries configuration

yashmayya commented on code in PR #12478:
URL: https://github.com/apache/kafka/pull/12478#discussion_r960435913


##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/RetryWithToleranceOperator.java:
##########
@@ -269,7 +289,7 @@ void backoff(int attempt, long deadline) {
             delay = deadline - time.milliseconds();
         }
         log.debug("Sleeping for {} millis", delay);
-        time.sleep(delay);
+        return !exitLatch.await(delay, TimeUnit.MILLISECONDS);

Review Comment:
   Ah, that's a very good point! I didn't account for this because I had (incorrectly) assumed that if a thread's interrupt status is set and a `CountDownLatch` has already been counted down to 0, a call to `CountDownLatch::await` would return immediately with `true` (i.e. the latch's count would be given "priority" over the thread's interrupt status). However, this isn't actually the case and the call to `CountDownLatch::await` will instead immediately throw an `InterruptedException` 😄



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org