[jira] [Commented] (ROCKETMQ-242) mqclient can not fetch nameSrvAddr periodly

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104473#comment-16104473
 ] 

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user coveralls commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/139
  

[![Coverage 
Status](https://coveralls.io/builds/12589514/badge)](https://coveralls.io/builds/12589514)

Coverage decreased (-0.002%) to 38.717% when pulling 
**fd635b6b28685dacfdfd3160abe2f761177685f1 on qqeasonchen:develop** into 
**118bdec96005ce695295bcf0d9082e0230e69bf7 on apache:develop**.



> mqclient can not fetch nameSrvAddr periodly
> ---
>
> Key: ROCKETMQ-242
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-242
> Project: Apache RocketMQ
>  Issue Type: Bug
>  Components: rocketmq-client
>Affects Versions: 4.0.0-incubating, 4.1.0-incubating
> Environment: test and production
>Reporter: Eason Chen
>Assignee: Xiaorui Wang
> Fix For: 4.2.0-incubating
>
>
> when mqclientinstance start, it getNameSrvAddr once by bellow code:
>  if (null == this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }
> but in startScheduledTask(),it will not start the schedule task if 
> namesrvAddr is not null
> code=
> public void start() throws MQClientException {
> synchronized (this) {
> switch (this.serviceState) {
> case CREATE_JUST:
> this.serviceState = ServiceState.START_FAILED;
> // If not specified,looking address from name server
>*{color:red} if (null == 
> this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }{color}*
> // Start request-response channel
> this.mQClientAPIImpl.start();
> // Start various schedule tasks
> this.startScheduledTask();
> // Start pull service
> this.pullMessageService.start();
> // Start rebalance service
> this.rebalanceService.start();
> // Start push service
> 
> this.defaultMQProducer.getDefaultMQProducerImpl().start(false);
> log.info("the client factory [{}] start OK", 
> this.clientId);
> this.serviceState = ServiceState.RUNNING;
> break;
> case RUNNING:
> break;
> case SHUTDOWN_ALREADY:
> break;
> case START_FAILED:
> throw new MQClientException("The Factory object[" + 
> this.getClientId() + "] has been created before, and failed.", null);
> default:
> break;
> }
> }
> }
> private void startScheduledTask() {
>   *{color:red} if (null == this.clientConfig.getNamesrvAddr()) {{color}*
> this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
> @Override
> public void run() {
> try {
> 
> MQClientInstance.this.mQClientAPIImpl.fetchNameServerAddr();
> } catch (Exception e) {
> log.error("ScheduledTask fetchNameServerAddr 
> exception", e);
> }
> }
> }, 1000 * 10, 1000 * 60 * 2, TimeUnit.MILLISECONDS);
> }



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


[jira] [Commented] (ROCKETMQ-242) mqclient can not fetch nameSrvAddr periodly

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104474#comment-16104474
 ] 

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user coveralls commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/139
  

[![Coverage 
Status](https://coveralls.io/builds/12589514/badge)](https://coveralls.io/builds/12589514)

Coverage decreased (-0.002%) to 38.717% when pulling 
**fd635b6b28685dacfdfd3160abe2f761177685f1 on qqeasonchen:develop** into 
**118bdec96005ce695295bcf0d9082e0230e69bf7 on apache:develop**.



> mqclient can not fetch nameSrvAddr periodly
> ---
>
> Key: ROCKETMQ-242
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-242
> Project: Apache RocketMQ
>  Issue Type: Bug
>  Components: rocketmq-client
>Affects Versions: 4.0.0-incubating, 4.1.0-incubating
> Environment: test and production
>Reporter: Eason Chen
>Assignee: Xiaorui Wang
> Fix For: 4.2.0-incubating
>
>
> when mqclientinstance start, it getNameSrvAddr once by bellow code:
>  if (null == this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }
> but in startScheduledTask(),it will not start the schedule task if 
> namesrvAddr is not null
> code=
> public void start() throws MQClientException {
> synchronized (this) {
> switch (this.serviceState) {
> case CREATE_JUST:
> this.serviceState = ServiceState.START_FAILED;
> // If not specified,looking address from name server
>*{color:red} if (null == 
> this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }{color}*
> // Start request-response channel
> this.mQClientAPIImpl.start();
> // Start various schedule tasks
> this.startScheduledTask();
> // Start pull service
> this.pullMessageService.start();
> // Start rebalance service
> this.rebalanceService.start();
> // Start push service
> 
> this.defaultMQProducer.getDefaultMQProducerImpl().start(false);
> log.info("the client factory [{}] start OK", 
> this.clientId);
> this.serviceState = ServiceState.RUNNING;
> break;
> case RUNNING:
> break;
> case SHUTDOWN_ALREADY:
> break;
> case START_FAILED:
> throw new MQClientException("The Factory object[" + 
> this.getClientId() + "] has been created before, and failed.", null);
> default:
> break;
> }
> }
> }
> private void startScheduledTask() {
>   *{color:red} if (null == this.clientConfig.getNamesrvAddr()) {{color}*
> this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
> @Override
> public void run() {
> try {
> 
> MQClientInstance.this.mQClientAPIImpl.fetchNameServerAddr();
> } catch (Exception e) {
> log.error("ScheduledTask fetchNameServerAddr 
> exception", e);
> }
> }
> }, 1000 * 10, 1000 * 60 * 2, TimeUnit.MILLISECONDS);
> }



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


[jira] [Commented] (ROCKETMQ-242) mqclient can not fetch nameSrvAddr periodly

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104475#comment-16104475
 ] 

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user coveralls commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/139
  

[![Coverage 
Status](https://coveralls.io/builds/12589514/badge)](https://coveralls.io/builds/12589514)

Coverage decreased (-0.002%) to 38.717% when pulling 
**fd635b6b28685dacfdfd3160abe2f761177685f1 on qqeasonchen:develop** into 
**118bdec96005ce695295bcf0d9082e0230e69bf7 on apache:develop**.



> mqclient can not fetch nameSrvAddr periodly
> ---
>
> Key: ROCKETMQ-242
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-242
> Project: Apache RocketMQ
>  Issue Type: Bug
>  Components: rocketmq-client
>Affects Versions: 4.0.0-incubating, 4.1.0-incubating
> Environment: test and production
>Reporter: Eason Chen
>Assignee: Xiaorui Wang
> Fix For: 4.2.0-incubating
>
>
> when mqclientinstance start, it getNameSrvAddr once by bellow code:
>  if (null == this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }
> but in startScheduledTask(),it will not start the schedule task if 
> namesrvAddr is not null
> code=
> public void start() throws MQClientException {
> synchronized (this) {
> switch (this.serviceState) {
> case CREATE_JUST:
> this.serviceState = ServiceState.START_FAILED;
> // If not specified,looking address from name server
>*{color:red} if (null == 
> this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }{color}*
> // Start request-response channel
> this.mQClientAPIImpl.start();
> // Start various schedule tasks
> this.startScheduledTask();
> // Start pull service
> this.pullMessageService.start();
> // Start rebalance service
> this.rebalanceService.start();
> // Start push service
> 
> this.defaultMQProducer.getDefaultMQProducerImpl().start(false);
> log.info("the client factory [{}] start OK", 
> this.clientId);
> this.serviceState = ServiceState.RUNNING;
> break;
> case RUNNING:
> break;
> case SHUTDOWN_ALREADY:
> break;
> case START_FAILED:
> throw new MQClientException("The Factory object[" + 
> this.getClientId() + "] has been created before, and failed.", null);
> default:
> break;
> }
> }
> }
> private void startScheduledTask() {
>   *{color:red} if (null == this.clientConfig.getNamesrvAddr()) {{color}*
> this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
> @Override
> public void run() {
> try {
> 
> MQClientInstance.this.mQClientAPIImpl.fetchNameServerAddr();
> } catch (Exception e) {
> log.error("ScheduledTask fetchNameServerAddr 
> exception", e);
> }
> }
> }, 1000 * 10, 1000 * 60 * 2, TimeUnit.MILLISECONDS);
> }



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


[jira] [Commented] (ROCKETMQ-242) mqclient can not fetch nameSrvAddr periodly

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104468#comment-16104468
 ] 

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user coveralls commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/136
  

[![Coverage 
Status](https://coveralls.io/builds/12589394/badge)](https://coveralls.io/builds/12589394)

Coverage decreased (-0.2%) to 38.519% when pulling 
**e66236ee5fbfb03426b7b4da6d663f1f8984f933 on qqeasonchen:master** into 
**118bdec96005ce695295bcf0d9082e0230e69bf7 on apache:develop**.



> mqclient can not fetch nameSrvAddr periodly
> ---
>
> Key: ROCKETMQ-242
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-242
> Project: Apache RocketMQ
>  Issue Type: Bug
>  Components: rocketmq-client
>Affects Versions: 4.0.0-incubating, 4.1.0-incubating
> Environment: test and production
>Reporter: Eason Chen
>Assignee: Xiaorui Wang
> Fix For: 4.2.0-incubating
>
>
> when mqclientinstance start, it getNameSrvAddr once by bellow code:
>  if (null == this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }
> but in startScheduledTask(),it will not start the schedule task if 
> namesrvAddr is not null
> code=
> public void start() throws MQClientException {
> synchronized (this) {
> switch (this.serviceState) {
> case CREATE_JUST:
> this.serviceState = ServiceState.START_FAILED;
> // If not specified,looking address from name server
>*{color:red} if (null == 
> this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }{color}*
> // Start request-response channel
> this.mQClientAPIImpl.start();
> // Start various schedule tasks
> this.startScheduledTask();
> // Start pull service
> this.pullMessageService.start();
> // Start rebalance service
> this.rebalanceService.start();
> // Start push service
> 
> this.defaultMQProducer.getDefaultMQProducerImpl().start(false);
> log.info("the client factory [{}] start OK", 
> this.clientId);
> this.serviceState = ServiceState.RUNNING;
> break;
> case RUNNING:
> break;
> case SHUTDOWN_ALREADY:
> break;
> case START_FAILED:
> throw new MQClientException("The Factory object[" + 
> this.getClientId() + "] has been created before, and failed.", null);
> default:
> break;
> }
> }
> }
> private void startScheduledTask() {
>   *{color:red} if (null == this.clientConfig.getNamesrvAddr()) {{color}*
> this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
> @Override
> public void run() {
> try {
> 
> MQClientInstance.this.mQClientAPIImpl.fetchNameServerAddr();
> } catch (Exception e) {
> log.error("ScheduledTask fetchNameServerAddr 
> exception", e);
> }
> }
> }, 1000 * 10, 1000 * 60 * 2, TimeUnit.MILLISECONDS);
> }



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


[jira] [Commented] (ROCKETMQ-242) mqclient can not fetch nameSrvAddr periodly

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104469#comment-16104469
 ] 

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user coveralls commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/136
  

[![Coverage 
Status](https://coveralls.io/builds/12589394/badge)](https://coveralls.io/builds/12589394)

Coverage decreased (-0.2%) to 38.519% when pulling 
**e66236ee5fbfb03426b7b4da6d663f1f8984f933 on qqeasonchen:master** into 
**118bdec96005ce695295bcf0d9082e0230e69bf7 on apache:develop**.



> mqclient can not fetch nameSrvAddr periodly
> ---
>
> Key: ROCKETMQ-242
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-242
> Project: Apache RocketMQ
>  Issue Type: Bug
>  Components: rocketmq-client
>Affects Versions: 4.0.0-incubating, 4.1.0-incubating
> Environment: test and production
>Reporter: Eason Chen
>Assignee: Xiaorui Wang
> Fix For: 4.2.0-incubating
>
>
> when mqclientinstance start, it getNameSrvAddr once by bellow code:
>  if (null == this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }
> but in startScheduledTask(),it will not start the schedule task if 
> namesrvAddr is not null
> code=
> public void start() throws MQClientException {
> synchronized (this) {
> switch (this.serviceState) {
> case CREATE_JUST:
> this.serviceState = ServiceState.START_FAILED;
> // If not specified,looking address from name server
>*{color:red} if (null == 
> this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }{color}*
> // Start request-response channel
> this.mQClientAPIImpl.start();
> // Start various schedule tasks
> this.startScheduledTask();
> // Start pull service
> this.pullMessageService.start();
> // Start rebalance service
> this.rebalanceService.start();
> // Start push service
> 
> this.defaultMQProducer.getDefaultMQProducerImpl().start(false);
> log.info("the client factory [{}] start OK", 
> this.clientId);
> this.serviceState = ServiceState.RUNNING;
> break;
> case RUNNING:
> break;
> case SHUTDOWN_ALREADY:
> break;
> case START_FAILED:
> throw new MQClientException("The Factory object[" + 
> this.getClientId() + "] has been created before, and failed.", null);
> default:
> break;
> }
> }
> }
> private void startScheduledTask() {
>   *{color:red} if (null == this.clientConfig.getNamesrvAddr()) {{color}*
> this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
> @Override
> public void run() {
> try {
> 
> MQClientInstance.this.mQClientAPIImpl.fetchNameServerAddr();
> } catch (Exception e) {
> log.error("ScheduledTask fetchNameServerAddr 
> exception", e);
> }
> }
> }, 1000 * 10, 1000 * 60 * 2, TimeUnit.MILLISECONDS);
> }



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


[jira] [Commented] (ROCKETMQ-242) mqclient can not fetch nameSrvAddr periodly

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104351#comment-16104351
 ] 

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user vsair commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/136
  
Any description about this PR ?  Or, you could add the jira link.


> mqclient can not fetch nameSrvAddr periodly
> ---
>
> Key: ROCKETMQ-242
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-242
> Project: Apache RocketMQ
>  Issue Type: Bug
>  Components: rocketmq-client
>Affects Versions: 4.0.0-incubating, 4.1.0-incubating
> Environment: test and production
>Reporter: Eason Chen
>Assignee: Xiaorui Wang
> Fix For: 4.2.0-incubating
>
>
> when mqclientinstance start, it getNameSrvAddr once by bellow code:
>  if (null == this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }
> but in startScheduledTask(),it will not start the schedule task if 
> namesrvAddr is not null
> code=
> public void start() throws MQClientException {
> synchronized (this) {
> switch (this.serviceState) {
> case CREATE_JUST:
> this.serviceState = ServiceState.START_FAILED;
> // If not specified,looking address from name server
>*{color:red} if (null == 
> this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }{color}*
> // Start request-response channel
> this.mQClientAPIImpl.start();
> // Start various schedule tasks
> this.startScheduledTask();
> // Start pull service
> this.pullMessageService.start();
> // Start rebalance service
> this.rebalanceService.start();
> // Start push service
> 
> this.defaultMQProducer.getDefaultMQProducerImpl().start(false);
> log.info("the client factory [{}] start OK", 
> this.clientId);
> this.serviceState = ServiceState.RUNNING;
> break;
> case RUNNING:
> break;
> case SHUTDOWN_ALREADY:
> break;
> case START_FAILED:
> throw new MQClientException("The Factory object[" + 
> this.getClientId() + "] has been created before, and failed.", null);
> default:
> break;
> }
> }
> }
> private void startScheduledTask() {
>   *{color:red} if (null == this.clientConfig.getNamesrvAddr()) {{color}*
> this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
> @Override
> public void run() {
> try {
> 
> MQClientInstance.this.mQClientAPIImpl.fetchNameServerAddr();
> } catch (Exception e) {
> log.error("ScheduledTask fetchNameServerAddr 
> exception", e);
> }
> }
> }, 1000 * 10, 1000 * 60 * 2, TimeUnit.MILLISECONDS);
> }



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


[jira] [Commented] (ROCKETMQ-242) mqclient can not fetch nameSrvAddr periodly

2017-07-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16104317#comment-16104317
 ] 

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user qqeasonchen commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/136
  
if (null == this.clientConfig.getNamesrvAddr()) {
   this.mQClientAPIImpl.fetchNameServerAddr();
}
@shroman this code still useful when init, and i will move to develop


> mqclient can not fetch nameSrvAddr periodly
> ---
>
> Key: ROCKETMQ-242
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-242
> Project: Apache RocketMQ
>  Issue Type: Bug
>  Components: rocketmq-client
>Affects Versions: 4.0.0-incubating, 4.1.0-incubating
> Environment: test and production
>Reporter: Eason Chen
>Assignee: Xiaorui Wang
> Fix For: 4.2.0-incubating
>
>
> when mqclientinstance start, it getNameSrvAddr once by bellow code:
>  if (null == this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }
> but in startScheduledTask(),it will not start the schedule task if 
> namesrvAddr is not null
> code=
> public void start() throws MQClientException {
> synchronized (this) {
> switch (this.serviceState) {
> case CREATE_JUST:
> this.serviceState = ServiceState.START_FAILED;
> // If not specified,looking address from name server
>*{color:red} if (null == 
> this.clientConfig.getNamesrvAddr()) {
> 
> this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
> }{color}*
> // Start request-response channel
> this.mQClientAPIImpl.start();
> // Start various schedule tasks
> this.startScheduledTask();
> // Start pull service
> this.pullMessageService.start();
> // Start rebalance service
> this.rebalanceService.start();
> // Start push service
> 
> this.defaultMQProducer.getDefaultMQProducerImpl().start(false);
> log.info("the client factory [{}] start OK", 
> this.clientId);
> this.serviceState = ServiceState.RUNNING;
> break;
> case RUNNING:
> break;
> case SHUTDOWN_ALREADY:
> break;
> case START_FAILED:
> throw new MQClientException("The Factory object[" + 
> this.getClientId() + "] has been created before, and failed.", null);
> default:
> break;
> }
> }
> }
> private void startScheduledTask() {
>   *{color:red} if (null == this.clientConfig.getNamesrvAddr()) {{color}*
> this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
> @Override
> public void run() {
> try {
> 
> MQClientInstance.this.mQClientAPIImpl.fetchNameServerAddr();
> } catch (Exception e) {
> log.error("ScheduledTask fetchNameServerAddr 
> exception", e);
> }
> }
> }, 1000 * 10, 1000 * 60 * 2, TimeUnit.MILLISECONDS);
> }



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


[jira] [Updated] (ROCKETMQ-250) fix fetchNSAddr error when it refer to jmenv.tbsite.net

2017-07-27 Thread Jaskey Lam (JIRA)

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

Jaskey Lam updated ROCKETMQ-250:

Description: 
*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}

  was:
*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.

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;
}


> 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) {
> 

[jira] [Updated] (ROCKETMQ-250) fix fetchNSAddr error when it refer to jmenv.tbsite.net

2017-07-27 Thread Jaskey Lam (JIRA)

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

Jaskey Lam updated ROCKETMQ-250:

Description: 
*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.

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;
}

  was:
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;
}


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