public final class DnsServerAddresses extends Object
DnsNameResolver
. The Iterator
created by the
Iterable
s returned by the factory methods of this class is infinite, which means Iterator.hasNext()
will never return false
and Iterator.next()
will never raise a NoSuchElementException
.Modifier and Type | Method and Description |
---|---|
static List<InetSocketAddress> |
defaultAddresses()
Returns the list of the system DNS server addresses.
|
static Iterable<InetSocketAddress> |
rotational(InetSocketAddress... addresses)
|
static Iterable<InetSocketAddress> |
rotational(Iterable<? extends InetSocketAddress> addresses)
|
static Iterable<InetSocketAddress> |
sequential(InetSocketAddress... addresses)
|
static Iterable<InetSocketAddress> |
sequential(Iterable<? extends InetSocketAddress> addresses)
|
static Iterable<InetSocketAddress> |
shuffled(InetSocketAddress... addresses)
|
static Iterable<InetSocketAddress> |
shuffled(Iterable<? extends InetSocketAddress> addresses)
|
static Iterable<InetSocketAddress> |
singleton(InetSocketAddress address)
|
public static List<InetSocketAddress> defaultAddresses()
"8.8.8.8"
and "8.8.4.4"
, the addresses of the
Google public DNS servers. Note that the Iterator
of the returned list is not infinite unlike other
factory methods in this class. To make the returned list infinite, pass it to the other factory method. e.g.
addresses =sequential
(defaultAddresses()
);
public static Iterable<InetSocketAddress> sequential(Iterable<? extends InetSocketAddress> addresses)
public static Iterable<InetSocketAddress> sequential(InetSocketAddress... addresses)
public static Iterable<InetSocketAddress> shuffled(Iterable<? extends InetSocketAddress> addresses)
public static Iterable<InetSocketAddress> shuffled(InetSocketAddress... addresses)
public static Iterable<InetSocketAddress> rotational(Iterable<? extends InetSocketAddress> addresses)
Iterable
of the specified DNS server addresses, whose Iterator
iterates
the DNS server addresses in a rotational order. It is similar to sequential(Iterable)
, but each
Iterator
starts from a different starting point. For example, the first Iterable.iterator()
will iterate from the first DNS server address, the second one will iterate from the second DNS server address,
and so on.public static Iterable<InetSocketAddress> rotational(InetSocketAddress... addresses)
Iterable
of the specified DNS server addresses, whose Iterator
iterates
the DNS server addresses in a rotational order. It is similar to sequential(Iterable)
, but each
Iterator
starts from a different starting point. For example, the first Iterable.iterator()
will iterate from the first DNS server address, the second one will iterate from the second DNS server address,
and so on.public static Iterable<InetSocketAddress> singleton(InetSocketAddress address)
Copyright © 2008–2015 The Netty Project. All rights reserved.