public String getRack(ServerName server) {
    if (server == null) {
      return UNKNOWN_RACK;
    }
    // just a note - switchMapping caches results (at least the implementation should unless the
    // resolution is really a lightweight process)
    List<String> racks = switchMapping.resolve(Collections.singletonList(server.getHostname()));
    if (racks != null && !racks.isEmpty()) {
      return racks.get(0);
    }

    return UNKNOWN_RACK;
  }
Get the name of the rack containing a server, according to the DNS to switch mapping.
@param server the server for which to get the rack name
@return the rack name of the server
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/RackManager.java