Ziy1-Tan commented on code in PR #7325:
URL: https://github.com/apache/rocketmq/pull/7325#discussion_r1319298949
##########
broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:
##########
@@ -1766,29 +1770,31 @@ public synchronized void
registerIncrementBrokerData(List<TopicConfig> topicConf
}
public synchronized void registerBrokerAll(final boolean checkOrderConfig,
boolean oneway, boolean forceRegister) {
+ ConcurrentMap<String, TopicConfig> topicConfigMap =
this.getTopicConfigManager().getTopicConfigTable();
- TopicConfigAndMappingSerializeWrapper topicConfigWrapper = new
TopicConfigAndMappingSerializeWrapper();
-
-
topicConfigWrapper.setDataVersion(this.getTopicConfigManager().getDataVersion());
-
topicConfigWrapper.setTopicConfigTable(this.getTopicConfigManager().getTopicConfigTable());
-
-
topicConfigWrapper.setTopicQueueMappingInfoMap(this.getTopicQueueMappingManager().getTopicQueueMappingTable().entrySet().stream().map(
+ Map<String, TopicQueueMappingInfo> topicQueueMappingInfoMap =
this.getTopicQueueMappingManager().getTopicQueueMappingTable().entrySet().stream().map(
entry -> new AbstractMap.SimpleImmutableEntry<>(entry.getKey(),
TopicQueueMappingDetail.cloneAsMappingInfo(entry.getValue()))
- ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
+ ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ ConcurrentHashMap<String, TopicConfig> topicConfigTable = new
ConcurrentHashMap<>();
if (!PermName.isWriteable(this.getBrokerConfig().getBrokerPermission())
||
!PermName.isReadable(this.getBrokerConfig().getBrokerPermission())) {
- ConcurrentHashMap<String, TopicConfig> topicConfigTable = new
ConcurrentHashMap<>();
- for (TopicConfig topicConfig :
topicConfigWrapper.getTopicConfigTable().values()) {
+ for (TopicConfig topicConfig : topicConfigMap.values()) {
Review Comment:
It will be registered out of for loop.
--
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]