chia7712 commented on a change in pull request #9707:
URL: https://github.com/apache/kafka/pull/9707#discussion_r538983484



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
##########
@@ -1116,11 +1116,12 @@ private boolean isInvokedFromCallback() {
      * </p>
      *
      * @throws InterruptException If the thread is interrupted while blocked
+     * @throws IllegalStateException If flush method in callback

Review comment:
       ```If the thread is callback thread. Calling flush() from callback is 
not allowed since it makes deadlock.```

##########
File path: 
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
##########
@@ -1116,11 +1116,12 @@ private boolean isInvokedFromCallback() {
      * </p>
      *
      * @throws InterruptException If the thread is interrupted while blocked
+     * @throws IllegalStateException If flush method in callback
      */
     @Override
     public void flush() {
         if (isInvokedFromCallback())
-            throw new UnsupportedOperationException("Can't specify flush 
method in callback.");
+            throw new IllegalStateException("Can't specify flush method in 
callback.");

Review comment:
       ```Calling flush() from callback is not allowed since it makes 
deadlock.```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to