Package io.grpc

Class EquivalentAddressGroup


  • @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
    public final class EquivalentAddressGroup
    extends Object
    A group of SocketAddresses 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.

    • 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 via ManagedChannelBuilder.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.

    • Method Detail

      • getAddresses

        public List<SocketAddress> getAddresses()
        Returns an immutable list of the addresses.
      • getAttributes

        @Attr
        public Attributes getAttributes()
        Returns the attributes.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object other)
        Returns true if the given object is also an 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).

        Overrides:
        equals in class Object