public void initialize() {
    for (ServerName sn : this.servers) {
      String rackName = getRackOfServer(sn);
      List<ServerName> serverList = this.rackToRegionServerMap.get(rackName);
      if (serverList == null) {
        serverList = Lists.newArrayList();
        // Add the current rack to the unique rack list
        this.uniqueRackList.add(rackName);
        this.rackToRegionServerMap.put(rackName, serverList);
      }
      for (ServerName serverName : serverList) {
        if (ServerName.isSameAddress(sn, serverName)) {
          // The server is already present, ignore.
          break;
        }
      }
      serverList.add(sn);
      this.regionServerToRackMap.put(sn.getHostname(), rackName);
    }
  }
Helper class for FavoredNodeLoadBalancer that has all the intelligence for racks, meta scans,
etc. Instantiated by the FavoredNodeLoadBalancer when needed (from within calls like
FavoredNodeLoadBalancer#randomAssignment(RegionInfo, List). All updates to favored nodes should
only be done from FavoredNodesManager and not through this helper class (except for tests).
hbase-balancer/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java