code: @Nullable
    public static String resolveHostName(String hostname) throws UnknownHostException {
      if (hostname == null || hostname.isEmpty()) {
        return null;
      }
  
      return InetAddress.getByName(hostname).getCanonicalHostName();
    }
docs: Resolves a given hostname by a canonical hostname. When a hostname alias (e.g., those specified
  in /etc/hosts) is given, the alias may not be resolvable on other hosts in a cluster unless the
  same alias is defined there.
  
  @param hostname the input hostname, which could be an alias
  @return the canonical form of the hostname, or null if it is null or empty
  @throws UnknownHostException if the given hostname cannot be resolved