Github user vsair commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/115#discussion_r121035368
--- Diff:
client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
---
@@ -621,34 +621,23 @@ public boolean
updateTopicRouteInfoFromNameServer(final String topic, boolean is
{
TopicPublishInfo publishInfo =
topicRouteData2TopicPublishInfo(topic, topicRouteData);
publishInfo.setHaveTopicRouterInfo(true);
- Iterator<Entry<String, MQProducerInner>>
it = this.producerTable.entrySet().iterator();
- while (it.hasNext()) {
- Entry<String, MQProducerInner> entry =
it.next();
- MQProducerInner impl =
entry.getValue();
- if (impl != null) {
- impl.updateTopicPublishInfo(topic,
publishInfo);
- }
- }
+ updatePubInfoTable(topic, publishInfo);
}
// Update sub info
{
Set<MessageQueue> subscribeInfo =
topicRouteData2TopicSubscribeInfo(topic, topicRouteData);
- Iterator<Entry<String, MQConsumerInner>>
it = this.consumerTable.entrySet().iterator();
- while (it.hasNext()) {
- Entry<String, MQConsumerInner> entry =
it.next();
- MQConsumerInner impl =
entry.getValue();
- if (impl != null) {
-
impl.updateTopicSubscribeInfo(topic, subscribeInfo);
- }
- }
+ updateSubInfoTable(topic, subscribeInfo);
}
log.info("topicRouteTable.put. Topic = {},
TopicRouteData[{}]", topic, cloneTopicRouteData);
this.topicRouteTable.put(topic,
cloneTopicRouteData);
return true;
}
} else {
- log.warn("updateTopicRouteInfoFromNameServer,
getTopicRouteInfoFromNameServer return null, Topic: {}", topic);
+ log.warn("updateTopicRouteInfoFromNameServer,
getTopicRouteInfoFromNameServer return null. Topic: {}", topic);
--- End diff --
IMO, API(getTopicRouteInfoFromNameServer) will throw exception when not
found topic route, so the logic will never enter 'else', am I right?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---