xdkxlk commented on code in PR #6682:
URL: https://github.com/apache/rocketmq/pull/6682#discussion_r1186599900
##########
broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:
##########
@@ -734,15 +767,13 @@ private int polling(final Channel channel,
RemotingCommand remotingCommand,
if (requestHeader.getPollTime() <= 0 ||
this.popLongPollingService.isStopped()) {
return NOT_POLLING;
}
- ConcurrentHashMap<String, Byte> cids =
topicCidMap.get(requestHeader.getTopic());
- if (cids == null) {
- cids = new ConcurrentHashMap<>();
- ConcurrentHashMap<String, Byte> old =
topicCidMap.putIfAbsent(requestHeader.getTopic(), cids);
- if (old != null) {
- cids = old;
- }
- }
- cids.putIfAbsent(requestHeader.getConsumerGroup(), Byte.MIN_VALUE);
+ topicCidMap.computeIfAbsent(requestHeader.getTopic(), k -> new
ConcurrentHashMap<>())
+ .putIfAbsent(requestHeader.getConsumerGroup(), Byte.MIN_VALUE);
+ final String popRetryTopic
+ = KeyBuilder.buildPopRetryTopic(requestHeader.getTopic(),
requestHeader.getConsumerGroup());
+ topicCidMap.computeIfAbsent(popRetryTopic, k -> new
ConcurrentHashMap<>())
Review Comment:
Why we need put popRetryTopic into topicCidMap? In
notifyRetryMessageArriving, the topic has been changed to normal topic.
--
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]