You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@rocketmq.apache.org by "Eason Chen (JIRA)" <ji...@apache.org> on 2017/07/26 11:24:02 UTC
[jira] [Created] (ROCKETMQ-250) fix fetchNSAddr error when it refer
to jmenv.tbsite.net
Eason Chen created ROCKETMQ-250:
-----------------------------------
Summary: 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
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.
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;
}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)