public String getCanonicalHostName(String hostName) {
    try {
      return InetAddress.getByName(hostName).getCanonicalHostName();
    }
    catch(UnknownHostException exception) {
      LOG.warn("Could not retrieve canonical hostname for " + hostName, exception);
      return hostName;
    }
  }
Method to get canonical-ized hostname, given a hostname (possibly a CNAME).
This should allow for service-principals to use simplified CNAMEs.
@param hostName The hostname to be canonical-ized.
@return Given a CNAME, the canonical-ized hostname is returned. If not found, the original hostname is returned.
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/security/HadoopThriftAuthBridge.java