Introduction


When I first saw the ConsumerDemoWithShutdown.java code, I was puzzled by this comment:



// get a reference to the main thread
final Thread mainThread = Thread.currentThread();






Why do we need a reference to the main thread? What's a Shutdown Hook? And what does join() actually do?

As a Java and Kafka beginner, these...