Class EquivalentAddressGroup
- java.lang.Object
-
- io.grpc.EquivalentAddressGroup
-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770") public final class EquivalentAddressGroup extends Object
A group ofSocketAddress
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
EquivalentAddressGroup.Attr
Annotation forEquivalentAddressGroup
's attributes.
-
Field Summary
Fields Modifier and Type Field Description static Attributes.Key<String>
ATTR_AUTHORITY_OVERRIDE
The authority to be used when constructing Subchannels for this EquivalentAddressGroup.
-
Constructor Summary
Constructors Constructor Description EquivalentAddressGroup(SocketAddress addr)
Singleton constructor without Attributes.EquivalentAddressGroup(SocketAddress addr, Attributes attrs)
Singleton constructor with Attributes.EquivalentAddressGroup(List<SocketAddress> addrs)
List constructor withoutAttributes
.EquivalentAddressGroup(List<SocketAddress> addrs, Attributes attrs)
List constructor withAttributes
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
Returns true if the given object is also anEquivalentAddressGroup
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()
-
-
-
Field Detail
-
ATTR_AUTHORITY_OVERRIDE
@Attr @ExperimentalApi("https://github.com/grpc/grpc-java/issues/6138") public static final Attributes.Key<String> ATTR_AUTHORITY_OVERRIDE
The authority to be used when constructing Subchannels for this EquivalentAddressGroup. However, if the channel has overridden authority viaManagedChannelBuilder.overrideAuthority(String)
, the transport will use the channel's authority override.The authority must be from a trusted source, because if the authority is tampered with, RPCs may be sent to attackers which may leak sensitive user data. If the authority was acquired by doing I/O, the communication must be authenticated (e.g., via TLS). Recognize that the server that provided the authority can trivially impersonate the service.
-
-
Constructor Detail
-
EquivalentAddressGroup
public EquivalentAddressGroup(List<SocketAddress> addrs)
List constructor withoutAttributes
.
-
EquivalentAddressGroup
public EquivalentAddressGroup(List<SocketAddress> addrs, @Attr Attributes attrs)
List constructor withAttributes
.
-
EquivalentAddressGroup
public EquivalentAddressGroup(SocketAddress addr)
Singleton constructor without Attributes.
-
EquivalentAddressGroup
public EquivalentAddressGroup(SocketAddress addr, @Attr Attributes attrs)
Singleton constructor with Attributes.
-
-
Method Detail
-
getAddresses
public List<SocketAddress> getAddresses()
Returns an immutable list of the addresses.
-
getAttributes
@Attr public Attributes getAttributes()
Returns the attributes.
-
equals
public boolean equals(Object other)
Returns true if the given object is also anEquivalentAddressGroup
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).
-
-