@Override
    public void close() {
        close(Duration.ofMillis(Long.MAX_VALUE));
    }
Close this producer. This method blocks until all previously sent requests complete.
This method is equivalent to <code>close(Long.MAX_VALUE, TimeUnit.MILLISECONDS)</code>.
<p>
<strong>If close() is called from {@link Callback}, a warning message will be logged and close(0, TimeUnit.MILLISECONDS)
will be called instead. We do this because the sender thread would otherwise try to join itself and
block forever.</strong>
<p>

@throws InterruptException If the thread is interrupted while blocked.
@throws KafkaException If an unexpected error occurs while trying to close the client, this error should be treated
                       as fatal and indicate the client is no longer usable.
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java