Package io.grpc

Class EquivalentAddressGroup

  • @ExperimentalApi("")
    public final class EquivalentAddressGroup
    extends java.lang.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


        public static final Attributes.Key<java.lang.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.

    • Constructor Detail

      • EquivalentAddressGroup

        public EquivalentAddressGroup​(java.util.List<> addrs)
        List constructor without Attributes.
      • EquivalentAddressGroup

        public EquivalentAddressGroup​(java.util.List<> addrs,
                                      Attributes attrs)
        List constructor with Attributes.
      • EquivalentAddressGroup

        public EquivalentAddressGroup​( addr)
        Singleton constructor without Attributes.
      • EquivalentAddressGroup

        public EquivalentAddressGroup​( addr,
                                      Attributes attrs)
        Singleton constructor with Attributes.
    • Method Detail

      • getAddresses

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

        public Attributes getAttributes()
        Returns the attributes.
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.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).

        equals in class java.lang.Object