pkumar-singh commented on a change in pull request #2240:
URL: https://github.com/apache/bookkeeper/pull/2240#discussion_r422686624
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/net/NetUtils.java
##########
@@ -85,4 +88,45 @@ public static String
resolveNetworkLocation(DNSToSwitchMapping dnsResolver, Inet
return rNames.get(0);
}
-}
+ public static String getLocalHost() throws UnknownHostException {
+ String ip = InetAddress.getLocalHost().getHostAddress();
+ if (InetAddress.getLocalHost().isLoopbackAddress()) {
Review comment:
How about something like this?
return (InetAddress.getLocalHost().isLoopbackAddress()) ? getValidAddress()
: InetAddress.getLocalHost().getHostAddress();
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]