Class HostnameResolver

java.lang.Object
org.apache.maven.buildcache.HostnameResolver

public final class HostnameResolver extends Object
Resolves and caches the canonical host name of the local machine.

The lookup is performed asynchronously in a separate thread because InetAddress.getLocalHost().getCanonicalHostName() may block for a considerable amount of time in environments with slow or misconfigured name resolution (for example DNS or mDNS timeouts).

To avoid delaying application processing, the caller waits only up to 1000L ms for the result. If the lookup does not complete in time or fails, the fallback value "unknown" is used instead.

The resolved value is cached after the first call to resolve().

  • Field Details

  • Method Details

    • resolve

      public static String resolve()