After shutting down the main thread and the consumer thread, the application still hangs for something like a minute. There is some thread still active. It eventually shuts down and the program exits.
The KafkaConsumer may have a background thread still running that doesn't get killed immediately after the consumer object goes out of scope. I think the time window for this can be reduced or eliminated. I tried using KafkaConsumer.close but it threw a concurrent modification exception. So there is a lock being held by a thread in the consumer, maybe while a network I/O connection is open to the broker.
After shutting down the main thread and the consumer thread, the application still hangs for something like a minute. There is some thread still active. It eventually shuts down and the program exits.
The KafkaConsumer may have a background thread still running that doesn't get killed immediately after the consumer object goes out of scope. I think the time window for this can be reduced or eliminated. I tried using KafkaConsumer.close but it threw a concurrent modification exception. So there is a lock being held by a thread in the consumer, maybe while a network I/O connection is open to the broker.
https://kafka.apache.org/documentation/