LoadBalancers. Each provider is bounded to a load-balancing policy name.
Implementations can be automatically discovered by gRPC via Java's SPI mechanism. For
automatic discovery, the implementation must have a zero-argument constructor and include
a resource named META-INF/services/io.grpc.LoadBalancerProvider in their JAR. The
file's contents should be the implementation's class name. Implementations that need arguments in
their constructor can be manually registered by LoadBalancerRegistry#register.
Implementations should not throw. If they do, it may interrupt class loading. If
exceptions may reasonably occur for implementation-specific reasons, implementations should
generally handle the exception gracefully and return false from isAvailable().
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final NameResolver. | UNKNOWN_CONFIG
A sentinel value indicating that service config is not supported. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public abstract String | getPolicyName()
Returns the load-balancing policy name associated with this provider, which makes it selectable
via |
| public abstract int | getPriority()
A priority, from 0 to 10 that this provider should be used, taking the current environment into consideration. |
| public final int | |
| public abstract boolean | isAvailable()
Whether this provider is available for use, taking the current environment into consideration. |
| public NameResolver. | Returns: a tuple of the fully parsed and validated balancer configuration, else the Status.The rawLoadBalancingPolicyConfig)Map representation of the load balancing
policy choice.Parses the config for the Load Balancing policy unpacked from the service config. |
| public final String |
| UNKNOWN_CONFIG | back to summary |
|---|---|
| private static final NameResolver. 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. | |
| LoadBalancerProvider | back to summary |
|---|---|
| public LoadBalancerProvider() | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object other) Overrides java. Uses identity equality.
| |
| getPolicyName | back to summary |
|---|---|
| public abstract String getPolicyName() Returns the load-balancing policy name associated with this provider, which makes it selectable
via The policy name should consist of only lower case letters letters, underscore and digits, and can only start with letters. | |
| getPriority | back to summary |
|---|---|
| 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. | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isAvailable | back to summary |
|---|---|
| public abstract boolean isAvailable() Whether this provider is available for use, taking the current environment into consideration.
If | |
| parseLoadBalancingPolicyConfig | back to summary |
|---|---|
| public NameResolver. Parses the config for the Load Balancing policy unpacked from the service config. This will
return a
| |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| UnknownConfig | back to summary |
|---|---|
| pack-priv UnknownConfig() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |