You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/02/26 14:37:24 UTC

[GitHub] [ignite] sk0x50 commented on a change in pull request #7457: IGNITE-12705 SYNC caches are rebalanced in the first place.

sk0x50 commented on a change in pull request #7457: IGNITE-12705 SYNC caches are rebalanced in the first place.
URL: https://github.com/apache/ignite/pull/7457#discussion_r384523982
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
 ##########
 @@ -3846,4 +3849,66 @@ void trim() {
             activeObjects.clear();
         }
     }
+
+    /**
+     * Represents a cache rebalance order that takes into account both values: rebalance order itself and rebalance mode.
+     * It is assumed SYNC caches should be rebalanced in the first place.
+     */
+    private static class CacheRebalanceOrder implements Comparable<CacheRebalanceOrder> {
 
 Review comment:
   Yes, it can be replaced. On the other hand, in this case, we need to implement two classes (`CacheRebalanceOrder` and `Comparator` itself) instead of one. The method equals can be removed in both cases I think, but I would prefer to support the general contract of `Map` (it is easy to implement and maintain).
   
   > Note that the ordering maintained by a tree map, like any sorted map, and whether or not an explicit comparator is provided, must be consistent with equals if this sorted map is to correctly implement the Map interface. (See Comparable or Comparator for a precise definition of consistent with equals.) This is so because the Map interface is defined in terms of the equals operation, but a sorted map performs all key comparisons using its compareTo (or compare) method, so two keys that are deemed equal by this method are, from the standpoint of the sorted map, equal. The behavior of a sorted map is well-defined even if its ordering is inconsistent with equals; it just fails to obey the general contract of the Map interface.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services