private double getWeightedLocality(int region, int entity) {
    return cluster.getOrComputeWeightedLocality(region, entity, type);
  }
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