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



##########
File path: 
clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java
##########
@@ -391,6 +391,31 @@ Sender newSender(LogContext logContext, KafkaClient 
kafkaClient, ProducerMetadat
         };
     }
 
+    @Test(timeout = 10000)
+    public void testFlushInCallbackNotCauseDeadlock() throws 
InterruptedException {
+        Map<String, Object> configs = new HashMap<>();
+        configs.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+        ProducerMetadata metadata = mock(ProducerMetadata.class);
+
+        when(metadata.fetch()).thenReturn(emptyCluster, emptyCluster, 
emptyCluster, onePartitionCluster);
+
+        KafkaProducer<String, String> producer = 
producerWithOverrideNewSender(configs, metadata);

Review comment:
       Could you use try block?




----------------------------------------------------------------
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