Class DNSDomainNameResolver

java.lang.Object
org.apache.hadoop.net.DNSDomainNameResolver
All Implemented Interfaces:
DomainNameResolver

public class DNSDomainNameResolver extends Object implements DomainNameResolver
DNSDomainNameResolver wraps up the default DNS service for forward/reverse DNS lookup. It also provides a function to resolve a host name to all of fully qualified domain names belonging to the IPs from this host name
  • Constructor Details

    • DNSDomainNameResolver

      public DNSDomainNameResolver()
  • Method Details

    • getAllByDomainName

      public InetAddress[] getAllByDomainName(String domainName) throws UnknownHostException
      Description copied from interface: DomainNameResolver
      Takes one domain name and returns its IP addresses based on the actual service discovery methods.
      Specified by:
      getAllByDomainName in interface DomainNameResolver
      Parameters:
      domainName - input domainName.
      Returns:
      all IP addresses
      Throws:
      UnknownHostException - indicate that the IP address of a host could not be determined.
    • getHostnameByIP

      public String getHostnameByIP(InetAddress address)
      Description copied from interface: DomainNameResolver
      Reverse lookup an IP address and get the fully qualified domain name(fqdn).
      Specified by:
      getHostnameByIP in interface DomainNameResolver
      Parameters:
      address - input address.
      Returns:
      fully qualified domain name
    • getAllResolvedHostnameByDomainName

      public String[] getAllResolvedHostnameByDomainName(String domainName, boolean useFQDN) throws UnknownHostException
      Description copied from interface: DomainNameResolver
      This function combines getAllByDomainName and getHostnameByIP, for a single domain name, it will first do a forward lookup to get all of IP addresses, then for each IP address, it will do a reverse lookup to get the fqdn. This function is necessary in secure environment since Kerberos uses fqdn in the service principal instead of IP.
      Specified by:
      getAllResolvedHostnameByDomainName in interface DomainNameResolver
      Parameters:
      domainName - input domainName.
      useFQDN - input useFQDN.
      Returns:
      all fully qualified domain names belonging to the IPs resolved from the input domainName
      Throws:
      UnknownHostException - indicate that the IP address of a host could not be determined.