diff --git a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java index 1b1ffcc9d15de..0229c43cb8b3c 100644 --- a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java +++ b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java @@ -1219,11 +1219,19 @@ private void ensureValidRecordSize(int size) { * flush all buffered records before performing the commit. This ensures that all the {@link #send(ProducerRecord)} * calls made since the previous {@link #beginTransaction()} are completed before the commit. *
+ *
+ * Important: This method should not be used within the callback provided to
+ * {@link #send(ProducerRecord, Callback)}. Invoking flush() in this context will cause a deadlock.
+ *