@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1770") public final class EquivalentAddressGroup extends Object
SocketAddress
es that are considered equivalent when channel makes connections.
Usually the addresses are addresses resolved from the same host name, and connecting to any of them is equally sufficient. They do have order. An address appears earlier on the list is likely to be tried earlier.
Modifier and Type | Class and Description |
---|---|
static interface |
EquivalentAddressGroup.Attr
Annotation for
EquivalentAddressGroup 's attributes. |
Modifier and Type | Field and Description |
---|---|
static Attributes.Key<String> |
ATTR_AUTHORITY_OVERRIDE
The authority to be used when constructing Subchannels for this EquivalentAddressGroup.
|
Constructor and Description |
---|
EquivalentAddressGroup(List<SocketAddress> addrs)
List constructor without
Attributes . |
EquivalentAddressGroup(List<SocketAddress> addrs,
Attributes attrs)
List constructor with
Attributes . |
EquivalentAddressGroup(SocketAddress addr)
Singleton constructor without Attributes.
|
EquivalentAddressGroup(SocketAddress addr,
Attributes attrs)
Singleton constructor with Attributes.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
Returns true if the given object is also an
EquivalentAddressGroup with an equal
address list and equal attribute values. |
List<SocketAddress> |
getAddresses()
Returns an immutable list of the addresses.
|
Attributes |
getAttributes()
Returns the attributes.
|
int |
hashCode() |
String |
toString() |
@EquivalentAddressGroup.Attr @ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/6138") public static final Attributes.Key<String> ATTR_AUTHORITY_OVERRIDE
ManagedChannelBuilder.overrideAuthority(String)
, the transport will use the channel's
authority override.public EquivalentAddressGroup(List<SocketAddress> addrs)
Attributes
.public EquivalentAddressGroup(List<SocketAddress> addrs, @EquivalentAddressGroup.Attr Attributes attrs)
Attributes
.public EquivalentAddressGroup(SocketAddress addr)
public EquivalentAddressGroup(SocketAddress addr, @EquivalentAddressGroup.Attr Attributes attrs)
public List<SocketAddress> getAddresses()
@EquivalentAddressGroup.Attr public Attributes getAttributes()
public boolean equals(Object other)
EquivalentAddressGroup
with an equal
address list and equal attribute values.
Note that if the attributes include mutable values, it is possible for two objects to be considered equal at one point in time and not equal at another (due to concurrent mutation of attribute values).