You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by yu...@apache.org on 2021/12/10 14:04:29 UTC

[rocketmq] branch develop updated: [ISSUE 3585] [Part A] eliminate reverse DNS lookup in MessageExt (#3586)

This is an automated email from the ASF dual-hosted git repository.

yuzhou pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4f18b0d  [ISSUE 3585] [Part A] eliminate reverse DNS lookup in MessageExt (#3586)
4f18b0d is described below

commit 4f18b0d7754d995daa949b167ea84e886d6b7f44
Author: huangli <ar...@gmail.com>
AuthorDate: Fri Dec 10 22:04:21 2021 +0800

    [ISSUE 3585] [Part A] eliminate reverse DNS lookup in MessageExt (#3586)
---
 .../src/main/java/org/apache/rocketmq/common/message/MessageExt.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
index 577c4f4..133cb93 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
@@ -153,6 +153,10 @@ public class MessageExt extends Message {
 
     public String getBornHostNameString() {
         if (null != this.bornHost) {
+            if (bornHost instanceof InetSocketAddress) {
+                // without reverse dns lookup
+                return ((InetSocketAddress) bornHost).getHostString();
+            }
             InetAddress inetAddress = ((InetSocketAddress) this.bornHost).getAddress();
 
             return null != inetAddress ? inetAddress.getHostName() : null;