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

2017-08-08 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user qqeasonchen closed the pull request at:

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


> 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=
> {code:java}
> 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);
> }
> {code}



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


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

2017-08-08 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user Jaskey commented on a diff in the pull request:

https://github.com/apache/incubator-rocketmq/pull/139#discussion_r131043380
  
--- Diff: 
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
 ---
@@ -255,19 +255,17 @@ public void start() throws MQClientException {
 }
 
 private void startScheduledTask() {
-if (null == this.clientConfig.getNamesrvAddr()) {
-this.scheduledExecutorService.scheduleAtFixedRate(new 
Runnable() {
+this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
--- End diff --

I don't see the problem if you agree that: dynamical fetch should only be 
trigged when user does not specify the ns explictly.

So it means 
if(USER DOES NOT SPECIFY NS) {
startFetch
}

where USER DOES NOT SPECIFY NS equals to `null == 
this.clientConfig.getNamesrvAddr()`


> 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=
> {code:java}
> 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);
> }
> {code}



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


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

2017-08-02 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user Jaskey commented on a diff in the pull request:

https://github.com/apache/incubator-rocketmq/pull/139#discussion_r131043088
  
--- Diff: 
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
 ---
@@ -255,19 +255,17 @@ public void start() throws MQClientException {
 }
 
 private void startScheduledTask() {
-if (null == this.clientConfig.getNamesrvAddr()) {
--- End diff --

@shroman  

Whether It has a  problem or not which depends on how user understand its 
purpose. In my point of view, my understanding would be:  user specified is 
always prior to dymatically fetched, which means if I specify, JUST DO NOT 
change it anymore since I have totolly understand the which nameserver I am 
using, I don't want to risk of changing my nameservers without my notice.

Sure, somebody's understanding would be: user specified is prior to 
dymatically fetch, however, this only happens when my specified nameserver 
address is available. 

I would say it is also reasonable. Maybe we can provide a policy for them 
to choose.


> 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=
> {code:java}
> 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);
> }
> {code}



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


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

2017-08-02 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user shroman commented on a diff in the pull request:

https://github.com/apache/incubator-rocketmq/pull/139#discussion_r131030593
  
--- Diff: 
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
 ---
@@ -255,19 +255,17 @@ public void start() throws MQClientException {
 }
 
 private void startScheduledTask() {
-if (null == this.clientConfig.getNamesrvAddr()) {
--- End diff --

@qqeasonchen If you agree with @Jaskey, then the current implementation is 
correct, isn't it? :)


> 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=
> {code:java}
> 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);
> }
> {code}



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


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

2017-08-02 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user qqeasonchen commented on a diff in the pull request:

https://github.com/apache/incubator-rocketmq/pull/139#discussion_r130866438
  
--- Diff: 
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
 ---
@@ -255,19 +255,17 @@ public void start() throws MQClientException {
 }
 
 private void startScheduledTask() {
-if (null == this.clientConfig.getNamesrvAddr()) {
--- End diff --

@Jaskey agree with you , and my question is if user does not specify an 
namesrv and its purpose is fetch from wsAddr , but client can not fetch 
namesrvs dymatically , see 

// If not specified,looking address from name server 
if (null == this.clientConfig.getNamesrvAddr()) { 
this.mQClientAPIImpl.fetchNameServerAddr(); }
 
private void startScheduledTask() {
  if (null == this.clientConfig.getNamesrvAddr()) {...}


> 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=
> {code:java}
> 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);
> }
> {code}



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


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

2017-08-02 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user qqeasonchen commented on a diff in the pull request:

https://github.com/apache/incubator-rocketmq/pull/139#discussion_r130805162
  
--- Diff: 
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
 ---
@@ -255,19 +255,17 @@ public void start() throws MQClientException {
 }
 
 private void startScheduledTask() {
-if (null == this.clientConfig.getNamesrvAddr()) {
--- End diff --

@shroman fetch name servers task must be running when client started so 
that client can update the failed namesrv by itself, we can  make some 
conditions to trigger it such as if wsAddr is not default


> 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=
> {code:java}
> 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);
> }
> {code}



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


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

2017-08-01 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user qqeasonchen commented on a diff in the pull request:

https://github.com/apache/incubator-rocketmq/pull/139#discussion_r130527608
  
--- Diff: 
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
 ---
@@ -255,19 +255,17 @@ public void start() throws MQClientException {
 }
 
 private void startScheduledTask() {
-if (null == this.clientConfig.getNamesrvAddr()) {
--- End diff --

in fact, even though we specified the web endpoint, client will not fetch 
name server addresses any more beacase of below code in start():

`// If not specified,looking address from name server
if (null == this.clientConfig.getNamesrvAddr()) {
this.mQClientAPIImpl.fetchNameServerAddr();
}`


> 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=
> {code:java}
> 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);
> }
> {code}



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


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

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

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user lizhanhui commented on a diff in the pull request:

https://github.com/apache/incubator-rocketmq/pull/139#discussion_r130507692
  
--- Diff: 
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
 ---
@@ -255,19 +255,17 @@ public void start() throws MQClientException {
 }
 
 private void startScheduledTask() {
-if (null == this.clientConfig.getNamesrvAddr()) {
--- End diff --

If name server addresses have been manually specified, why should we still 
periodically fetch name server addresses from web endpoint?


> 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=
> {code:java}
> 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);
> }
> {code}



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


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

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

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user qqeasonchen commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/139
  
@Jaskey @shroman @zhouxinyu 
create a pull request again due to previous wrong commit ,pls help to 
review, thx.


> 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=
> {code:java}
> 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);
> }
> {code}



--
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=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] [Commented] (ROCKETMQ-242) mqclient can not fetch nameSrvAddr periodly

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

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user shroman commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/136
  
Then you probably don't need this code
```
if (null == this.clientConfig.getNamesrvAddr()) {
   this.mQClientAPIImpl.fetchNameServerAddr();
}
```


> 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-26 Thread ASF GitHub Bot (JIRA)

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

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/12556621/badge)](https://coveralls.io/builds/12556621)

Coverage decreased (-0.7%) to 38.433% when pulling 
**63704577e51534a7f793d5c13b23cd91c188 on qqeasonchen:master** into 
**d4149207e27ed3516f1f06407b55986790b806ae on apache:master**.



> 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-26 Thread ASF GitHub Bot (JIRA)

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

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/12556621/badge)](https://coveralls.io/builds/12556621)

Coverage decreased (-0.7%) to 38.433% when pulling 
**63704577e51534a7f793d5c13b23cd91c188 on qqeasonchen:master** into 
**d4149207e27ed3516f1f06407b55986790b806ae on apache:master**.



> 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-26 Thread ASF GitHub Bot (JIRA)

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

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/12555899/badge)](https://coveralls.io/builds/12555899)

Coverage decreased (-0.5%) to 38.646% when pulling 
**bf213c5ec8ab529678fcd694be9d24f099639328 on qqeasonchen:master** into 
**d4149207e27ed3516f1f06407b55986790b806ae on apache:master**.



> 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-26 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

GitHub user qqeasonchen opened a pull request:

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

[ROCKETMQ-242] mqclient can not fetch nameSrvAddr periodly



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/qqeasonchen/incubator-rocketmq master

Alternatively you can review and apply these changes as the patch at:

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

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #136


commit bf213c5ec8ab529678fcd694be9d24f099639328
Author: easoncchen 
Date:   2017-07-26T10:20:43Z

[ROCKETMQ-242] mqclient can not fetch nameSrvAddr periodly




> 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-26 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

Github user qqeasonchen closed the pull request at:

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


> 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-26 Thread Eason Chen (JIRA)

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

Eason Chen commented on ROCKETMQ-242:
-

What if the specified namesrv is down and changed to another ip address? and 
the client can change namesrv dynamic and do not need to restart.

> 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-26 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on ROCKETMQ-242:
-

GitHub user qqeasonchen opened a pull request:

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

[ROCKETMQ-242] mqclient can not fetch nameSrvAddr periodly



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/qqeasonchen/incubator-rocketmq master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-rocketmq/pull/135.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #135


commit 7f4b4488ff07703d89e3a07bbe4dd7ae8d4172b4
Author: easoncchen 
Date:   2017-07-26T07:12:26Z

[ROCKETMQ-242] mqclient can not fetch nameSrvAddr periodly




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