junrao commented on code in PR #19862:
URL: https://github.com/apache/kafka/pull/19862#discussion_r2136586587


##########
server-common/src/main/java/org/apache/kafka/server/purgatory/DelayedOperation.java:
##########
@@ -58,26 +58,15 @@ public DelayedOperation(long delayMs) {
      * true, others will still return false.
      */
     public boolean forceComplete() {
-        // Do not proceed if the operation is already completed.
-        if (completed) {
+        if (!completed) {
+            completed = true;
+            // cancel the timeout timer
+            cancel();
+            onComplete();
+            return true;

Review Comment:
   Hmm, this doesn't seem to work for `DelayedFuturePurgatory` since it calls 
forceComplete() without holding a lock.
   
   `           BiConsumer<Void, Throwable> callbackAction = (result, exception) 
-> delayedFuture.forceComplete();
   `
   
   If there is no benefit from removing the return type of `forceComplete()`, 
we could probably just dismiss this PR.



-- 
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-unsubscr...@kafka.apache.org

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

Reply via email to