mirror of https://github.com/grpc/grpc-java.git
xds: use predefined XdsLbPolicies constants instead of string literals for consistency (#9408)
This commit is contained in:
parent
10979b2e2c
commit
1fe3ed9b53
|
@ -47,7 +47,7 @@ public final class PriorityLoadBalancerProvider extends LoadBalancerProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPolicyName() {
|
public String getPolicyName() {
|
||||||
return "priority_experimental";
|
return XdsLbPolicies.PRIORITY_POLICY_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -281,7 +281,7 @@ final class XdsNameResolver extends NameResolver {
|
||||||
Map<String, ?> rawServiceConfig = ImmutableMap.of(
|
Map<String, ?> rawServiceConfig = ImmutableMap.of(
|
||||||
"loadBalancingConfig",
|
"loadBalancingConfig",
|
||||||
ImmutableList.of(ImmutableMap.of(
|
ImmutableList.of(ImmutableMap.of(
|
||||||
"cluster_manager_experimental",
|
XdsLbPolicies.CLUSTER_MANAGER_POLICY_NAME,
|
||||||
ImmutableMap.of("childPolicy", childPolicy.buildOrThrow()))));
|
ImmutableMap.of("childPolicy", childPolicy.buildOrThrow()))));
|
||||||
|
|
||||||
if (logger.isLoggable(XdsLogLevel.INFO)) {
|
if (logger.isLoggable(XdsLogLevel.INFO)) {
|
||||||
|
@ -1014,13 +1014,15 @@ final class XdsNameResolver extends NameResolver {
|
||||||
|
|
||||||
private Map<String, ?> toLbPolicy() {
|
private Map<String, ?> toLbPolicy() {
|
||||||
if (traditionalCluster != null) {
|
if (traditionalCluster != null) {
|
||||||
return ImmutableMap.of("cds_experimental", ImmutableMap.of("cluster", traditionalCluster));
|
return ImmutableMap.of(
|
||||||
|
XdsLbPolicies.CDS_POLICY_NAME,
|
||||||
|
ImmutableMap.of("cluster", traditionalCluster));
|
||||||
} else {
|
} else {
|
||||||
ImmutableMap<String, ?> rlsConfig = new ImmutableMap.Builder<String, Object>()
|
ImmutableMap<String, ?> rlsConfig = new ImmutableMap.Builder<String, Object>()
|
||||||
.put("routeLookupConfig", rlsPluginConfig.config())
|
.put("routeLookupConfig", rlsPluginConfig.config())
|
||||||
.put(
|
.put(
|
||||||
"childPolicy",
|
"childPolicy",
|
||||||
ImmutableList.of(ImmutableMap.of("cds_experimental", ImmutableMap.of())))
|
ImmutableList.of(ImmutableMap.of(XdsLbPolicies.CDS_POLICY_NAME, ImmutableMap.of())))
|
||||||
.put("childPolicyConfigTargetFieldName", "cluster")
|
.put("childPolicyConfigTargetFieldName", "cluster")
|
||||||
.buildOrThrow();
|
.buildOrThrow();
|
||||||
return ImmutableMap.of("rls_experimental", rlsConfig);
|
return ImmutableMap.of("rls_experimental", rlsConfig);
|
||||||
|
|
Loading…
Reference in New Issue