Interface AdvancedHostResolver

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clearDNSCache()
      Clears both the positive (successful DNS lookups) and negative (failed DNS lookups) cache.
      void clearHostRemappings()
      Removes all hostname remappings.
      java.util.Map<java.lang.String,​java.lang.String> getHostRemappings()
      Returns all host remappings in effect.
      java.util.Collection<java.lang.String> getOriginalHostnames​(java.lang.String remappedHost)
      Returns the original address or addresses that are remapped to the specified remappedHost.
      void remapHost​(java.lang.String originalHost, java.lang.String remappedHost)
      Remaps an individual host.
      void remapHosts​(java.util.Map<java.lang.String,​java.lang.String> hostRemappings)
      Replaces the host remappings in the existing list of remappings (if any) with the specified remappings.
      void removeHostRemapping​(java.lang.String originalHost)
      Removes the specified host remapping.
      void setNegativeDNSCacheTimeout​(int timeout, java.util.concurrent.TimeUnit timeUnit)
      Sets the negative (failed DNS lookup) timeout when making DNS lookups.
      void setPositiveDNSCacheTimeout​(int timeout, java.util.concurrent.TimeUnit timeUnit)
      Sets the positive (successful DNS lookup) timeout when making DNS lookups.
    • Method Detail

      • remapHosts

        void remapHosts​(java.util.Map<java.lang.String,​java.lang.String> hostRemappings)
        Replaces the host remappings in the existing list of remappings (if any) with the specified remappings. The remappings will be applied in the order specified by the Map's iterator. Note: The original hostnames must exactly match the requested hostname. It is not a domain or regular expression match.
        Parameters:
        hostRemappings - Map of <original hostname, remapped hostname>
      • remapHost

        void remapHost​(java.lang.String originalHost,
                       java.lang.String remappedHost)
        Remaps an individual host. If there are any existing remappings, the new remapping will be applied last, after all existing remappings are applied. If there is already a remapping for the specified originalHost, it will be removed before the new remapping is added to the end of the host remapping list (and will therefore be the last remapping applied).
        Parameters:
        originalHost - Original host to remap. Must exactly match the requested hostname (not a domain or regular expression match).
        remappedHost - hostname that will replace originalHost
      • removeHostRemapping

        void removeHostRemapping​(java.lang.String originalHost)
        Removes the specified host remapping. If the remapping does not exist, this method has no effect.
        Parameters:
        originalHost - currently-remapped hostname
      • clearHostRemappings

        void clearHostRemappings()
        Removes all hostname remappings.
      • getHostRemappings

        java.util.Map<java.lang.String,​java.lang.String> getHostRemappings()
        Returns all host remappings in effect. Iterating over the returned Map is guaranteed to return remappings in the order in which the remappings are actually applied.
        Returns:
        Map of <original hostname, remapped hostname>
      • getOriginalHostnames

        java.util.Collection<java.lang.String> getOriginalHostnames​(java.lang.String remappedHost)
        Returns the original address or addresses that are remapped to the specified remappedHost. Iterating over the returned Collection is guaranteed to return original mappings in the order in which the remappings are applied.
        Parameters:
        remappedHost - remapped hostname
        Returns:
        original hostnames that are remapped to the specified remappedHost, or an empty Collection if no remapping is defined to the remappedHost
      • clearDNSCache

        void clearDNSCache()
        Clears both the positive (successful DNS lookups) and negative (failed DNS lookups) cache.
      • setPositiveDNSCacheTimeout

        void setPositiveDNSCacheTimeout​(int timeout,
                                        java.util.concurrent.TimeUnit timeUnit)
        Sets the positive (successful DNS lookup) timeout when making DNS lookups. Note: The timeUnit parameter does not guarantee the specified precision; implementations may need to reduce precision, depending on the underlying DNS implementation. For example, the Oracle JVM's DNS cache only supports timeouts in whole seconds, so specifying a timeout of 1200ms will result in a timeout of 1 second.
        Parameters:
        timeout - maximum lookup time
        timeUnit - units of the timeout value
      • setNegativeDNSCacheTimeout

        void setNegativeDNSCacheTimeout​(int timeout,
                                        java.util.concurrent.TimeUnit timeUnit)
        Sets the negative (failed DNS lookup) timeout when making DNS lookups. Note: The timeUnit parameter does not guarantee the specified precision; implementations may need to reduce precision, depending on the underlying DNS implementation. For example, the Oracle JVM's DNS cache only supports timeouts in whole seconds, so specifying a timeout of 1200ms will result in a timeout of 1 second.
        Parameters:
        timeout - maximum lookup time
        timeUnit - units of the timeout value