@Override
  public final List<RegionPlan>
    balanceCluster(Map<TableName, Map<ServerName, List<RegionInfo>>> loadOfAllTable) {
    preBalanceCluster(loadOfAllTable);
    if (isByTable) {
      List<RegionPlan> result = new ArrayList<>();
      loadOfAllTable.forEach((tableName, loadOfOneTable) -> {
        LOG.info("Start Generate Balance plan for table: " + tableName);
        List<RegionPlan> partialPlans = balanceTable(tableName, loadOfOneTable);
        if (partialPlans != null) {
          result.addAll(partialPlans);
        }
      });
      return result;
    } else {
      LOG.debug("Start Generate Balance plan for cluster.");
      return balanceTable(HConstants.ENSEMBLE_TABLE_NAME, toEnsumbleTableLoad(loadOfAllTable));
    }
  }
Perform the major balance operation for cluster, will invoke
{@link #balanceTable(TableName, Map)} to do actual balance.
<p/>
THIs method is marked as final which means you should not override this method. See the javadoc
for {@link #balanceTable(TableName, Map)} for more details.
@param loadOfAllTable region load of servers for all table
@return a list of regions to be moved, including source and destination, or null if cluster is
        already balanced
@see #balanceTable(TableName, Map)
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java