public static void validateHostName(Boolean clusterMapResolveHostnames, String hostName) {
    if (clusterMapResolveHostnames) {
      String fqdn = getFullyQualifiedDomainName(hostName);
      if (!fqdn.equals(hostName)) {
        throw new IllegalArgumentException(
            "Hostname(" + hostName + ") does not match its fully qualified domain name: " + fqdn);
      }
    }
  }
Validate hostName.
@param clusterMapResolveHostnames indicates if a reverse DNS lookup is enabled or not.
@param hostName hostname to be validated.
@throws IllegalArgumentException if hostname is not valid.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/ClusterMapUtils.java