Oliverwqcwrw commented on code in PR #5110:
URL: https://github.com/apache/rocketmq/pull/5110#discussion_r973813496


##########
common/src/main/java/org/apache/rocketmq/common/BrokerIdentity.java:
##########
@@ -98,14 +110,8 @@ public void setInBrokerContainer(boolean inBrokerContainer) 
{
         isInBrokerContainer = inBrokerContainer;
     }
 
-    protected static String localHostName() {
-        try {
-            return InetAddress.getLocalHost().getHostName();
-        } catch (UnknownHostException e) {
-            LOGGER.error("Failed to obtain the host name", e);
-        }
-
-        return "DEFAULT_BROKER";
+    private String defaultBrokerName() {
+        return localHostName == null ? "DEFAULT_BROKER" : localHostName;

Review Comment:
   ```suggestion
           return StringUtils.isEmpty(localHostName) ? "DEFAULT_BROKER" : 
localHostName;
   ```



-- 
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: dev-unsubscr...@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to