@RestrictedApi(explanation = "Should only be called in tests", link = "",
      allowedOnPath = ".*(/src/test/.*|HeterogeneousRegionCountCostFunction).java")
  void loadRules() {
    final List<String> lines = readFile(this.rulesPath);
    if (null == lines) {
      LOG.warn("cannot load rules file, keeping latest rules file which has "
        + this.limitPerRule.size() + " rules");
      return;
    }

    LOG.info("loading rules file '" + this.rulesPath + "'");
    this.limitPerRule.clear();
    for (final String line : lines) {
      try {
        if (line.length() == 0) {
          continue;
        }
        if (line.startsWith("#")) {
          continue;
        }
        final List<String> splits = Splitter.on(' ').splitToList(line);
        if (splits.size() != 2) {
          throw new IOException(
            "line '" + line + "' is malformated, " + "expected [regexp] [limit]. Skipping line");
        }

        final Pattern pattern = Pattern.compile(splits.get(0));
        final Integer limit = Integer.parseInt(splits.get(1));
        this.limitPerRule.put(pattern, limit);
      } catch (final IOException | NumberFormatException | PatternSyntaxException e) {
        LOG.error("error on line: " + e);
      }
    }
    this.rebuildCache();
  }
used to load the rule files.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/HeterogeneousRegionCountCostFunction.java