private void includeExcludeRegionServers(String fileName, List<ServerName> regionServers,
    boolean isInclude) throws IOException {
    if (fileName != null) {
      List<String> servers = readServersFromFile(fileName);
      if (servers.isEmpty()) {
        LOG.warn("No servers provided in the file: {}." + fileName);
        return;
      }
      Iterator<ServerName> i = regionServers.iterator();
      while (i.hasNext()) {
        String rs = i.next().getServerName();
        String rsPort = rs.split(ServerName.SERVERNAME_SEPARATOR)[0].toLowerCase() + ":"
          + rs.split(ServerName.SERVERNAME_SEPARATOR)[1];
        if (isInclude != servers.contains(rsPort)) {
          i.remove();
        }
      }
    }
  }
Designates or excludes the servername whose hostname and port portion matches the list given in
the file. Example:<br>
If you want to designated RSs, suppose designatedFile has RS1, regionServers has RS1, RS2 and
RS3. When we call includeExcludeRegionServers(designatedFile, regionServers, true), RS2 and RS3
are removed from regionServers list so that regions can move to only RS1. If you want to
exclude RSs, suppose excludeFile has RS1, regionServers has RS1, RS2 and RS3. When we call
includeExcludeRegionServers(excludeFile, servers, false), RS1 is removed from regionServers
list so that regions can move to only RS2 and RS3.
hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java