Github user lei-xia commented on a diff in the pull request: https://github.com/apache/helix/pull/31#discussion_r34328550 --- Diff: helix-core/src/main/java/org/apache/helix/spectator/RoutingTableProvider.java --- @@ -235,8 +376,94 @@ PartitionInfo get(String stateUnitKey) { } } + class ResourceGroupInfo { + // store PartitionInfo for each partition for all resources in the resource group + HashMap<String, PartitionInfo> partitionInfoMap; + // stores the Set of Instances in a given state for all resources in the resource group + HashMap<String, Set<InstanceConfig>> stateInfoMap; + // stores the ResourceInfo for each resource with different instance tag. + HashMap<String, ResourceInfo> tagResourceInfoMap; + + public ResourceGroupInfo() { + partitionInfoMap = new HashMap<String, RoutingTableProvider.PartitionInfo>(); + stateInfoMap = new HashMap<String, Set<InstanceConfig>>(); + tagResourceInfoMap = new HashMap<String, ResourceInfo>(); + } + + public void addEntry(String resourceTag, String stateUnitKey, String state, InstanceConfig config) { + // add + if (!stateInfoMap.containsKey(state)) { + Comparator<InstanceConfig> comparator = new Comparator<InstanceConfig>() { --- End diff -- move the comparator outside and defined it as a static variable in RoutingTableProvider class.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---