Package io.grpc

Class LoadBalancerProvider

    • Field Detail

      • UNKNOWN_CONFIG

        private static final NameResolver.ConfigOrError UNKNOWN_CONFIG
        A sentinel value indicating that service config is not supported. This can be used to indicate that parsing of the service config is neither right nor wrong, but doesn't have any meaning.
    • Constructor Detail

      • LoadBalancerProvider

        public LoadBalancerProvider()
    • Method Detail

      • getPriority

        public abstract int getPriority()
        A priority, from 0 to 10 that this provider should be used, taking the current environment into consideration. 5 should be considered the default, and then tweaked based on environment detection. A priority of 0 does not imply that the provider wouldn't work; just that it should be last in line.
      • getPolicyName

        public abstract java.lang.String getPolicyName()
        Returns the load-balancing policy name associated with this provider, which makes it selectable via LoadBalancerRegistry.getProvider(java.lang.String). This is called only when the class is loaded. It shouldn't change, and there is no point doing so.

        The policy name should consist of only lower case letters letters, underscore and digits, and can only start with letters.

      • parseLoadBalancingPolicyConfig

        public NameResolver.ConfigOrError parseLoadBalancingPolicyConfig​(java.util.Map<java.lang.String,​?> rawLoadBalancingPolicyConfig)
        Parses the config for the Load Balancing policy unpacked from the service config. This will return a NameResolver.ConfigOrError which contains either the successfully parsed config, or the Status representing the failure to parse. Implementations are expected to not throw exceptions but return a Status representing the failure. If successful, the load balancing policy config should be immutable.
        Parameters:
        rawLoadBalancingPolicyConfig - The Map representation of the load balancing policy choice.
        Returns:
        a tuple of the fully parsed and validated balancer configuration, else the Status.
        Since:
        1.20.0
        See Also:
        A24-lb-policy-config.md
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object other)
        Uses identity equality.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object