apoorvmittal10 opened a new pull request, #19759: URL: https://github.com/apache/kafka/pull/19759
The `onComplete` method in DelayedOperation is guaranteed to run only once, either by `tryComplete` or `onExpiration`. The invocation of `tryComplete` is done by attaining `lock` so no concurrent execution of `tryComplete` happens for same delayed operation. However, there can be concurrent execution of `tryComplete` and `onComplete` as the `expiration` thread can trigger a separte run of `onComplete` while `tryComplete` is still executing. This behaviour is not ideal as there are parallel runs where 1 threads method execution is wasteful i.e. if `onComplete` is already invoked by another thread then execution of `tryComplete` is not required. -- 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