15712852007 commented on code in PR #4562:
URL: https://github.com/apache/rocketmq/pull/4562#discussion_r914392492


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -671,8 +676,18 @@ private SendResult sendDefaultImpl(
     private TopicPublishInfo tryToFindTopicPublishInfo(final String topic) {
         TopicPublishInfo topicPublishInfo = 
this.topicPublishInfoTable.get(topic);
         if (null == topicPublishInfo || !topicPublishInfo.ok()) {
-            this.topicPublishInfoTable.putIfAbsent(topic, new 
TopicPublishInfo());
-            this.mQClientFactory.updateTopicRouteInfoFromNameServer(topic);
+            try {

Review Comment:
   > Add a double-check for this topicRoute, if there's existed topicRoute, 
return it directly, and it seems that we don't need to add another lock
   
   Thank you very much for your reply, but there is such a scenario, the 
producer during startup, will be intervals of 30 s updated routing information, 
if add the calibration topicRouter exists within 
updateTopicRouteInfoFromNameServer method, It may cause topicRouter not to 
update in time, so I tried to put the lock on a higher level method



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to