private void rebuildCache() {
    LOG.debug("Rebuilding cache of capacity for each RS");
    this.limitPerRS.clear();
    this.totalCapacity = 0;
    if (null == this.cluster) {
      return;
    }
    for (int i = 0; i < this.cluster.numServers; i++) {
      final ServerName sn = this.cluster.servers[i];
      final int capacity = this.findLimitForRS(sn);
      LOG.debug(sn.getHostname() + " can hold " + capacity + " regions");
      this.totalCapacity += capacity;
    }
    overallUsage = (double) this.cluster.numRegions / (double) this.totalCapacity;
    LOG.info("Cluster can hold " + this.cluster.numRegions + "/" + this.totalCapacity + " regions ("
      + Math.round(overallUsage * 100) + "%)");
    if (overallUsage >= 1) {
      LOG.warn("Cluster is overused, {}", overallUsage);
    }
  }
Rebuild cache matching ServerNames and their capacity.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/HeterogeneousRegionCountCostFunction.java