sijie commented on a change in pull request #5966: [Issue 5952] [pulsar-broker] 
fix ConcurrentModificationException while load-report 
serialization/updateLocalBrokerData 
URL: https://github.com/apache/pulsar/pull/5966#discussion_r364492593
 
 

 ##########
 File path: 
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/TopicStats.java
 ##########
 @@ -131,7 +136,12 @@ public TopicStats add(TopicStats stats) {
             }
         } else {
             for (String repl : stats.replication.keySet()) {
-                this.replication.get(repl).add(stats.replication.get(repl));
+                if (this.replication.get(repl) != null) {
 
 Review comment:
   If you are already changing the map from a `Map` to a `ConcurrentMap`, 
doesn't it mean there are concurrent updates? If so, since we already are using 
a concurrent map, we should consider using CAS operations to do better, no?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to