chia7712 commented on code in PR #20930:
URL: https://github.com/apache/kafka/pull/20930#discussion_r2543580545
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventHandler.java:
##########
@@ -71,7 +71,18 @@ public ApplicationEventHandler(final LogContext logContext,
requestManagersSupplier,
asyncConsumerMetrics);
- this.networkThread.start(initializationTimeoutMs);
+ try {
+ networkThread.start(initializationTimeoutMs);
+ } catch (Exception e) {
+ try {
+ networkThread.close();
+ } finally {
+ networkThread = null;
Review Comment:
I'm not sure why this is being set to null. Since this is the constructor,
it should be fine to leave the variable as it is. For example:
```
networkThread = new ConsumerNetworkThread(logContext,
time,
applicationEventQueue,
applicationEventReaper,
applicationEventProcessorSupplier,
networkClientDelegateSupplier,
requestManagersSupplier,
asyncConsumerMetrics);
try {
networkThread.start(initializationTimeoutMs);
} catch (Exception e) {
networkThread.close();
throw e;
}
```
--
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]