lhotari commented on code in PR #4588:
URL: https://github.com/apache/bookkeeper/pull/4588#discussion_r2048488033


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieImpl.java:
##########
@@ -267,25 +266,16 @@ public static BookieSocketAddress 
getBookieAddress(ServerConfiguration conf)
             iface = "default";
         }
 
-        String hostName = DNS.getDefaultHost(iface);
-        InetSocketAddress inetAddr = new InetSocketAddress(hostName, 
conf.getBookiePort());
-        if (inetAddr.isUnresolved()) {
-            throw new UnknownHostException("Unable to resolve default 
hostname: "
-                    + hostName + " for interface: " + iface);
-        }
-        String hostAddress = null;
-        InetAddress iAddress = inetAddr.getAddress();
+        String hostAddress = DNS.getDefaultIP(iface);
         if (conf.getUseHostNameAsBookieID()) {
-            hostAddress = iAddress.getCanonicalHostName();
+            hostAddress = 
InetAddress.getByName(hostAddress).getCanonicalHostName();

Review Comment:
   I guess the main value is that it adds the interface information to the 
exception message



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

Reply via email to