WhyStart opened a new pull request, #9262: URL: https://github.com/apache/rocketmq/pull/9262
…mProperty. <!-- Please make sure the target branch is right. In most case, the target branch should be `develop`. --> ### Which Issue(s) This PR Fixes <!-- Please ensure that the related issue has already been created, and [link this pull request to that issue using keywords](<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>) to ensure automatic closure. --> Fixes #3294 ### Brief Description In a springboot+rocketmq project, starting up and loading topics on Windows is very slow, especially on computers that have virtual machines installed, with an average of 4 seconds to load each topic. After learning from some materials that this is due to network adapter issues, I think we can pass the clientIP through System.property. If it's not passed that way, then we can obtain the LocalIP through NetworkUtil.getLocalAddress(). ```java public ClientConfig() { String ip = System.getProperty("rocketmq.client.ip"); if (ip != null && !ip.trim().isEmpty()) { clientIP = ip; } else { clientIP = NetworkUtil.getLocalAddress(); } } ``` <!-- Write a brief description for your pull request to help the maintainer understand the reasons behind your changes. --> ### How Did You Test This Change? ```java @Test public void testClientIpOverrideWithSystemProperty() { String ip = "192.168.8.8"; System.setProperty("rocketmq.client.ip", ip); ClientConfig clientConfig = new ClientConfig(); assertEquals(ip, clientConfig.getClientIP()); System.clearProperty("rocketmq.client.ip"); clientConfig = new ClientConfig(); assertEquals(NetworkUtil.getLocalAddress(), clientConfig.getClientIP()); } ``` <!-- In order to ensure the code quality of Apache RocketMQ, we expect every pull request to have undergone thorough testing. --> -- 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: commits-unsubscr...@rocketmq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org