m1a2st commented on code in PR #17217:
URL: https://github.com/apache/kafka/pull/17217#discussion_r1866836832


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkClientTest.java:
##########
@@ -268,26 +269,40 @@ public void testMetadataFailurePropagated() {
     public void testFutureCompletionOutsidePoll() throws Exception {
         // Tests the scenario in which the request that is being awaited in 
one thread
         // is received and completed in another thread.
+        
+        final CountDownLatch t1TheardCountDownLatch = new CountDownLatch(1);
+        final CountDownLatch t2ThreadCountDownLatch = new CountDownLatch(2);
 
         final RequestFuture<ClientResponse> future = consumerClient.send(node, 
heartbeat());
         consumerClient.pollNoWakeup(); // dequeue and send the request
 
         client.enableBlockingUntilWakeup(2);
-        Thread t1 = new Thread(() -> consumerClient.pollNoWakeup());
+        Thread t1 = new Thread(() ->  {
+            t1TheardCountDownLatch.countDown();
+            consumerClient.pollNoWakeup();
+            t2ThreadCountDownLatch.countDown();

Review Comment:
   `t2ThreadCountDownLatch` init value is 2, so we can ensure t2 thread will 
wakeup after `main` thread `client.wakeup()` and `t1` thread 
`consumerClient.pollNoWakeup()`



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

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

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

Reply via email to