[ 
https://issues.apache.org/jira/browse/ROCKETMQ-250?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eason Chen closed ROCKETMQ-250.
-------------------------------
    Resolution: Fixed

> fix fetchNSAddr error when it refer to jmenv.tbsite.net
> -------------------------------------------------------
>
>                 Key: ROCKETMQ-250
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-250
>             Project: Apache RocketMQ
>          Issue Type: Improvement
>          Components: rocketmq-commons
>    Affects Versions: 4.1.0-incubating
>         Environment: test and production
>            Reporter: Eason Chen
>            Assignee: Jixiang Jin
>             Fix For: 4.2.0-incubating
>
>
> *strong text*jmenv.tbsite.net may can not be reached in inner envirment  when 
> find it periodly
> we can return null when application does not set the new wsAddr.
> {code}
> public final String fetchNSAddr(boolean verbose, long timeoutMills) {
>         String url = this.wsAddr;
>         try {
>             if (this.wsAddr.equals(MixAll.WS_ADDR)) {
>                 return null;
>             }
>             if (!UtilAll.isBlank(this.unitName)) {
>                 url = url + "-" + this.unitName + "?nofix=1";
>             }
>             HttpTinyClient.HttpResult result = HttpTinyClient.httpGet(url, 
> null, null, "UTF-8", timeoutMills);
>             if (200 == result.code) {
>                 String responseStr = result.content;
>                 if (responseStr != null) {
>                     return clearNewLine(responseStr);
>                 } else {
>                     log.error("fetch nameserver address is null");
>                 }
>             } else {
>                 log.error("fetch nameserver address failed. statusCode={}", 
> result.code);
>             }
>         } catch (IOException e) {
>             if (verbose) {
>                 log.error("fetch name server address exception", e);
>             }
>         }
>         if (verbose) {
>             String errorMsg =
>                 "connect to " + url + " failed, maybe the domain name " + 
> MixAll.getWSAddr() + " not bind in /etc/hosts";
>             errorMsg += 
> FAQUrl.suggestTodo(FAQUrl.NAME_SERVER_ADDR_NOT_EXIST_URL);
>             log.warn(errorMsg);
>         }
>         return null;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to