Class DnsServerAddresses


  • public abstract class DnsServerAddresses
    extends java.lang.Object
    Provides an infinite sequence of DNS server addresses to DnsNameResolver.
    • Constructor Detail

      • DnsServerAddresses

        public DnsServerAddresses()
    • Method Detail

      • defaultAddressList

        @Deprecated
        public static java.util.List<java.net.InetSocketAddress> defaultAddressList()
        Deprecated.
        Use DefaultDnsServerAddressStreamProvider.defaultAddressList().

        Returns the list of the system DNS server addresses. If it failed to retrieve the list of the system DNS server addresses from the environment, it will return "8.8.8.8" and "8.8.4.4", the addresses of the Google public DNS servers.

      • defaultAddresses

        @Deprecated
        public static DnsServerAddresses defaultAddresses()
        Deprecated.
        Use DefaultDnsServerAddressStreamProvider.defaultAddresses().

        Returns the DnsServerAddresses that yields the system DNS server addresses sequentially. If it failed to retrieve the list of the system DNS server addresses from the environment, it will use "8.8.8.8" and "8.8.4.4", the addresses of the Google public DNS servers.

        This method has the same effect with the following code:

         DnsServerAddresses.sequential(DnsServerAddresses.defaultAddressList());
         

      • sequential

        public static DnsServerAddresses sequential​(java.lang.Iterable<? extends java.net.InetSocketAddress> addresses)
        Returns the DnsServerAddresses that yields the specified addresses sequentially. Once the last address is yielded, it will start again from the first address.
      • sequential

        public static DnsServerAddresses sequential​(java.net.InetSocketAddress... addresses)
        Returns the DnsServerAddresses that yields the specified addresses sequentially. Once the last address is yielded, it will start again from the first address.
      • shuffled

        public static DnsServerAddresses shuffled​(java.lang.Iterable<? extends java.net.InetSocketAddress> addresses)
        Returns the DnsServerAddresses that yields the specified address in a shuffled order. Once all addresses are yielded, the addresses are shuffled again.
      • shuffled

        public static DnsServerAddresses shuffled​(java.net.InetSocketAddress... addresses)
        Returns the DnsServerAddresses that yields the specified addresses in a shuffled order. Once all addresses are yielded, the addresses are shuffled again.
      • rotational

        public static DnsServerAddresses rotational​(java.lang.Iterable<? extends java.net.InetSocketAddress> addresses)
        Returns the DnsServerAddresses that yields the specified addresses in a rotational sequential order. It is similar to sequential(Iterable), but each DnsServerAddressStream starts from a different starting point. For example, the first stream() will start from the first address, the second one will start from the second address, and so on.
      • rotational

        public static DnsServerAddresses rotational​(java.net.InetSocketAddress... addresses)
        Returns the DnsServerAddresses that yields the specified addresses in a rotational sequential order. It is similar to sequential(Iterable), but each DnsServerAddressStream starts from a different starting point. For example, the first stream() will start from the first address, the second one will start from the second address, and so on.