private int getMostLocalEntityForRegion(int region) {
    return cluster.getOrComputeRegionsToMostLocalEntities(type)[region];
  }
Maps region to the current entity (server or rack) on which it is stored
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/LocalityBasedCostFunction.java