Github user lizhanhui commented on a diff in the pull request:

    https://github.com/apache/incubator-rocketmq/pull/157#discussion_r135698929
  
    --- Diff: common/src/main/java/org/apache/rocketmq/common/MixAll.java ---
    @@ -407,12 +408,50 @@ private static String localhost() {
                 InetAddress addr = InetAddress.getLocalHost();
                 return addr.getHostAddress();
             } catch (Throwable e) {
    +            try {
    +                String candidatesHost = getLocalhostByNetworkInterface();
    +                if (candidatesHost != null)
    +                    return candidatesHost;
    +
    +            } catch (Exception ignored) {
    +            }
    +
                 throw new RuntimeException("InetAddress 
java.net.InetAddress.getLocalHost() throws UnknownHostException"
                     + FAQUrl.suggestTodo(FAQUrl.UNKNOWN_HOST_EXCEPTION),
                     e);
             }
         }
     
    +    private static String getLocalhostByNetworkInterface() throws 
SocketException {
    --- End diff --
    
    RemotingUtil has already had a similar method, aka, getLocalAddress, is 
there any rational reason to create a duplicated one?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to