LI123456mo opened a new pull request, #15979:
URL: https://github.com/apache/dubbo/pull/15979

   ## What is the purpose of the change
   This PR addresses the `// TODO: Help me to optimize the ugly sleep` in 
`StartZookeeperWindowsProcessor.java`. 
   
   The previous implementation used a hardcoded `TimeUnit.SECONDS.sleep(3)`, 
which was inefficient and potentially flaky. I have replaced it with a 
socket-based polling mechanism that:
   1. Checks the specific `clientPorts` from the context.
   2. Polls every 500ms to see if the port is open.
   3. Includes a 10-second timeout to prevent infinite hangs.
   
   ## Brief changelog
   - Removed the static 3-second sleep.
   - Added a polling loop using `java.net.Socket` to verify Zookeeper is ready.
   - Maintained existing logging patterns to keep the console output consistent.
   
   ## Verifying this change
   - Since this is a Windows-specific processor, I have verified the change on 
a Windows environment.
   - Ran `mvn clean compile -pl dubbo-test/dubbo-test-check` to ensure no 
regressions in the module.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to