public static String getHostName() {
    try {
      return InetAddress.getLocalHost().getHostName();
    } catch (UnknownHostException e) {
      return LOCALHOST;
    }
  }
Will return hostname stored in InetAddress.

@return hostname
llap-client/src/java/org/apache/hadoop/hive/registry/RegistryUtilities.java