class NetUtils {

  public static String getHostName(String address) {
    try {
      int i = address.indexOf(':');
      if (i > -1) {
        address = address.substring(0, i);
      }
      String hostname = hostNameCache.get(address);
      if (hostname != null && hostname.length() > 0) {
        return hostname;
      }
      InetAddress inetAddress = InetAddress.getByName(address);
      if (inetAddress != null) {
        hostname = inetAddress.getHostName();
        hostNameCache.put(address, hostname);
        return hostname;
      }
    } catch (Throwable e) {
      // ignore
    }
    return address;
  }

}