lizhiboo commented on code in PR #4562:
URL: https://github.com/apache/rocketmq/pull/4562#discussion_r915373979
##########
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 {
+ if(lockUpdatePublishInfo.tryLock(LOCK_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS)){
Review Comment:
We can add a parameter isEmpty2FetchFromNamesrv in
mQClientFactory.updateTopicRouteInfoFromNameServer method. if
isEmpty2FetchFromNamesrv is true, and double-check topic route info is also
empty after tryLock, then update from namesrv. if isEmpty2FetchFromNamesrv is
false, and double-check topic route info is not empty after tryLock, then do
not update from namesrv. MQClientInstance's scheduled task will update topic
route info reguarly.
--
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]