ifplusor commented on a change in pull request #2983:
URL: https://github.com/apache/rocketmq/pull/2983#discussion_r730374895



##########
File path: 
client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageStagedConcurrentlyService.java
##########
@@ -179,15 +179,20 @@ public AtomicInteger getCurrentStageOffset(MessageQueue 
messageQueue, String top
         if (null == groupByStrategy) {
             ConcurrentMap<String, ConcurrentMap<String, AtomicInteger>> 
stageOffset = stageOffsetStore == null ?
                 new ConcurrentHashMap<>() : 
convert(stageOffsetStore.readStageOffset(messageQueue, 
ReadOffsetType.MEMORY_FIRST_THEN_STORE));
-            currentStageOffsetMap.putIfAbsent(topic, stageOffset);
+            currentStageOffsetMap.put(topic, stageOffset);
             groupByStrategy = currentStageOffsetMap.get(topic);
         }
-        ConcurrentMap<String, AtomicInteger> groups = 
groupByStrategy.putIfAbsent(strategyId, new ConcurrentHashMap<>());
+        ConcurrentMap<String, AtomicInteger> groups = 
groupByStrategy.get(strategyId);
         if (null == groups) {
+            groupByStrategy.put(strategyId, new ConcurrentHashMap<>());

Review comment:
       `putIfAbsent` is correct under concurrent.




-- 
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