public final class MultipleAddresses extends Object
Modifier and Type | Field and Description |
---|---|
static Duration |
DEFAULT_TIMEOUT |
Constructor and Description |
---|
MultipleAddresses() |
MultipleAddresses(Collection<InetSocketAddress> addresses) |
MultipleAddresses(Collection<InetSocketAddress> addresses,
Duration timeout) |
MultipleAddresses(InetSocketAddress address) |
Modifier and Type | Method and Description |
---|---|
void |
addAddress(InetSocketAddress address) |
boolean |
equals(Object o) |
Set<InetSocketAddress> |
getAllAddresses()
Returns all addresses in an unmodifiable set.
|
List<String> |
getAllHostStrings()
Returns distinct list of all host strings
|
List<Integer> |
getAllPorts()
Returns all ports
|
Set<InetSocketAddress> |
getAllReachableAddresses()
Returns a set of all reachable addresses.
|
Set<InetSocketAddress> |
getAllReachableAddressesOrAll()
Returns a set of all reachable addresses.
|
InetSocketAddress |
getOne()
Returns an address from the set.
|
InetSocketAddress |
getReachableAddress()
Returns a reachable address.
|
InetSocketAddress |
getReachableOrOne()
Returns a reachable address or an arbitrary one, if none is reachable.
|
Set<InetSocketAddress> |
getWildcardAddresses()
Returns wildcard addresses for all ports
|
int |
hashCode() |
boolean |
isEmpty() |
void |
recreateSocketAddresses()
Performs a parallel DNS lookup for all addresses.
|
int |
size()
Returns the number of addresses in the set.
|
String |
toString() |
public static final Duration DEFAULT_TIMEOUT
public MultipleAddresses()
public MultipleAddresses(Collection<InetSocketAddress> addresses)
public MultipleAddresses(InetSocketAddress address)
public MultipleAddresses(Collection<InetSocketAddress> addresses, Duration timeout)
public boolean isEmpty()
public Set<InetSocketAddress> getAllAddresses()
public Set<InetSocketAddress> getWildcardAddresses()
public List<String> getAllHostStrings()
public void addAddress(InetSocketAddress address)
public InetSocketAddress getReachableAddress() throws NoRouteToHostException
NoRouteToHostException
- if none of the addresses are reachablepublic Set<InetSocketAddress> getAllReachableAddresses()
public Set<InetSocketAddress> getAllReachableAddressesOrAll()
public InetSocketAddress getReachableOrOne()
NoSuchElementException
- if there is no address registeredpublic void recreateSocketAddresses()
public InetSocketAddress getOne()
NoSuchElementException
- if there is no address registeredpublic int size()
Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.