private ResourceConfig getResourceConfig(String resourceName, String dcName) {
    if (!resourceConfigs.contains(resourceName)) {
      ConfigAccessor configAccessor;
      if (clusterMapConfig.clusterMapUseAggregatedView) {
        configAccessor = helixAggregatedViewClusterInfo.helixManager.getConfigAccessor();
      } else {
        configAccessor = ((HelixDcInfo) dcToDcInfo.get(dcName)).helixManager.getConfigAccessor();
      }
      logger.info("Fetching resource config for {}", resourceName);
      ResourceConfig resourceConfig = configAccessor.getResourceConfig(clusterName, resourceName);
      if (resourceConfig != null) {
        try {
          Map<String, Map<String, Integer>> partitionCapacityMap = resourceConfig.getPartitionCapacityMap();
          if (partitionCapacityMap != null && !partitionCapacityMap.isEmpty()) {
            partitionCapacityMap.forEach((partition, capacityMap) -> {
              if (capacityMap.containsKey(DISK_KEY)) {
                diskWeightForPartitions.put(partition, capacityMap.get(DISK_KEY));
              }
            });
          }
        } catch (Exception e) {
          logger.error("Failed to get partition capacity map from resource config for resource {} in dc {}",
              resourceName, dcName, e);
        }
      } else {
        // There is no config created for this resource, just make an empty one
        logger.info("No resource config found for {} in dc {}", resourceName, dcName);
        resourceConfig = new ResourceConfig(resourceName);
      }
      resourceConfigs.putIfAbsent(resourceName, resourceConfig);
    }
    return resourceConfigs.get(resourceName);
  }
Return resource config from the cache if it's present, otherwise, fetch it from Helix.
@param resourceName The resource name
@param dcName The datacenter name
@return The {@link ResourceConfig} object. If there is no config for the given resource name, null would be returned.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixClusterManager.java