lianetm commented on code in PR #20290:
URL: https://github.com/apache/kafka/pull/20290#discussion_r2260155894
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java:
##########
@@ -895,12 +895,14 @@ private void close(final Duration timeout, final boolean
swallowException) {
closeTimer.update();
// Prepare shutting down the network thread
- swallow(log, Level.ERROR, "Failed to release assignment before closing
consumer",
- () -> sendAcknowledgementsAndLeaveGroup(closeTimer,
firstException), firstException);
- swallow(log, Level.ERROR, "Failed to stop finding coordinator",
- this::stopFindCoordinatorOnClose, firstException);
- swallow(log, Level.ERROR, "Failed invoking acknowledgement commit
callback",
- () -> handleCompletedAcknowledgements(true), firstException);
+ if (applicationEventHandler != null && backgroundEventReaper != null
&& backgroundEventQueue != null) {
+ swallow(log, Level.ERROR, "Failed to release assignment before
closing consumer",
+ () -> sendAcknowledgementsAndLeaveGroup(closeTimer,
firstException), firstException);
+ swallow(log, Level.ERROR, "Failed to stop finding coordinator",
+ this::stopFindCoordinatorOnClose, firstException);
Review Comment:
agree, also the `handleCompletedAcknowledgements` seems to only need the
background components?
Wonder if it would be clearer to do the null checks inside each func (where
we can easily see the component they need, and will avoid facing this same
issue again if they end up being reused)
--
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]