Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.net
Class NetUtils.QualifiedHostResolver

    java.lang.Object
      org.apache.hadoop.net.NetUtils.QualifiedHostResolver

All Implemented Interfaces:
  NetUtils.HostResolver

Enclosing class:
  NetUtils

    protected static class NetUtils.QualifiedHostResolver

extends Object
implements NetUtils.HostResolver

This an alternate resolver with important properties that the standard java resolver lacks: 1) The hostname is fully qualified. This avoids security issues if not all hosts in the cluster do not share the same search domains. It also prevents other hosts from performing unnecessary dns searches. In contrast, InetAddress simply returns the host as given. 2) The InetAddress is instantiated with an exact host and IP to prevent further unnecessary lookups. InetAddress may perform an unnecessary reverse lookup for an IP. 3) A call to getHostName() will always return the qualified hostname, or more importantly, the IP if instantiated with an IP. This avoids unnecessary dns timeouts if the host is not resolvable. 4) Point 3 also ensures that if the host is re-resolved, ex. during a connection re-attempt, that a reverse lookup to host and forward lookup to IP is not performed since the reverse/forward mappings may not always return the same IP. If the client initiated a connection with an IP, then that IP is all that should ever be contacted. NOTE: this resolver is only used if: hadoop.security.token.service.use_ip=false

Constructor Summary
`protected` | `NetUtils.QualifiedHostResolver()`

Method Summary
`InetAddress` | `getByName(String host)` Create an InetAddress with a fully qualified hostname of the given hostname.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NetUtils.QualifiedHostResolver

    protected NetUtils.QualifiedHostResolver()

Method Detail

### getByName

    public InetAddress getByName(String host)
                          throws UnknownHostException

  Create an InetAddress with a fully qualified hostname of the given hostname. InetAddress does not qualify an incomplete hostname that is resolved via the domain search list. `InetAddress.getCanonicalHostName()` will fully qualify the hostname, but it always return the A record whereas the given hostname may be a CNAME.

  Specified by:
    `getByName` in interface `NetUtils.HostResolver`
  Parameters:
    `host` - a hostname or ip address
  Returns:
    InetAddress with the fully qualified hostname or ip
  Throws:
    `UnknownHostException` - if host does not exist

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation