jack2012aa commented on PR #20381:
URL: https://github.com/apache/kafka/pull/20381#issuecomment-3204187545

   > Thanks for the PR. As I understand, the one goal is to "mock these 
metadata updates" to avoid or remove any usage of Thread.sleep / Utils.sleep / 
Time.SYSTEM, as well as any additional threads if possible. But, looks like the 
code still sleep in every place without actually mocking the metadata updates.
   
   Hello @Yunyung, thank you for the review. 
   
   The major reason I keep the threads is to control the mock time. Although 
MockClient has the advanceTimeDuringPoll flag, its comment in MockClient#poll 
says that it works when no response is received (though it does not work like 
that).
   
   A thread-free approach will be combining MockClient#prepareMetadataUpdate 
and the advance time flag. However, a new issue is that we can't distinguish 
whether the producer requests an update; the timeout may be triggered 
automatically by MockClient#poll. We can add another check on how many updates 
do the mock client consume. If you think this is a better method, I am willing 
to write a new version.
   
   As for sleep, I only use CountDownLatch for the new await method. Since it 
is not a busy waiting, I seem it as acceptable. It can also be removed if we 
use the thread-free approach.


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