public void shutdown() {
        if (!closed) {
            closed = true;
            latch.countDown();
        }
    }
A simple producer thread supporting two send modes:
- Async mode (default): records are sent without waiting for the response.
- Sync mode: each send operation blocks waiting for the response.
examples/src/main/java/kafka/examples/Producer.java