shishkovilja commented on code in PR #12958:
URL: https://github.com/apache/ignite/pull/12958#discussion_r3020951792


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java:
##########
@@ -319,7 +325,9 @@ public void addLostPartitions(int grpId, 
Collection<Integer> lostParts) {
      * @return Partition update counters.
      */
     public CachePartitionFullCountersMap partitionUpdateCounters(int grpId) {
-        return partCntrs == null ? null : partCntrs.get(grpId);
+        synchronized (mux) {

Review Comment:
   ```suggestion
           synchronized (partCntrs) {
   ```
   
   ?



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java:
##########
@@ -278,10 +281,13 @@ public void addFullPartitionsMap(int grpId, 
GridDhtPartitionFullMap fullMap, @Nu
      * @param cntrMap Partition update counters.
      */
     public void addPartitionUpdateCounters(int grpId, 
CachePartitionFullCountersMap cntrMap) {
-        if (partCntrs == null)
-            partCntrs = new IgniteDhtPartitionCountersMap();
+        synchronized (mux) {
+            if (partCntrs == null)
+                partCntrs = new HashMap<>();
 
-        partCntrs.putIfAbsent(grpId, cntrMap);
+            if (!partCntrs.containsKey(grpId))

Review Comment:
   Any reason not to use `putIfAbsent`?



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java:
##########
@@ -278,10 +281,13 @@ public void addFullPartitionsMap(int grpId, 
GridDhtPartitionFullMap fullMap, @Nu
      * @param cntrMap Partition update counters.
      */
     public void addPartitionUpdateCounters(int grpId, 
CachePartitionFullCountersMap cntrMap) {
-        if (partCntrs == null)
-            partCntrs = new IgniteDhtPartitionCountersMap();
+        synchronized (mux) {

Review Comment:
   May be like below?
   ```suggestion
           synchronized (partCntrs) {
   ```



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