MINOR: Fix ConsumerNetworkThread shutdown (#14913)

This patch fixes a race condition in the shutdown logic of the `ConsumerNetworkThread`. The `running` variable could be set to `true` after `closeInternal` was called.

Reviewers: Andrew Schofield <aschofield@confluent.io>, Lucas Brutschy <lbrutschy@confluent.io>
This commit is contained in:
David Jacot 2023-12-04 20:01:59 +01:00 committed by GitHub
parent bbe87322e6
commit ddf99880d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -78,13 +78,11 @@ public class ConsumerNetworkThread extends KafkaThread implements Closeable {
this.applicationEventProcessorSupplier = applicationEventProcessorSupplier; this.applicationEventProcessorSupplier = applicationEventProcessorSupplier;
this.networkClientDelegateSupplier = networkClientDelegateSupplier; this.networkClientDelegateSupplier = networkClientDelegateSupplier;
this.requestManagersSupplier = requestManagersSupplier; this.requestManagersSupplier = requestManagersSupplier;
this.running = true;
} }
@Override @Override
public void run() { public void run() {
closer.assertOpen("Consumer network thread is already closed");
running = true;
try { try {
log.debug("Consumer network thread started"); log.debug("Consumer network thread started");