private static String getHostNameMinusDomain(final String hostname) {
    if (InetAddresses.isInetAddress(hostname)) {
      return hostname;
    }
    List<String> parts = Splitter.on('.').splitToList(hostname);
    if (parts.size() == 0) {
      return hostname;
    }
    Iterator<String> i = parts.iterator();
    return i.next();
  }
@param hostname the hostname string to get the actual hostname from
@return hostname minus the domain, if there is one (will do pass-through on ip addresses)
hbase-common/src/main/java/org/apache/hadoop/hbase/ServerName.java