Skip to content

Commit 04f1cc5

Browse files
committed
xds: Make XdsNR.RoutingConfig.empty a constant
The field was made final in 4b52639 but was soon reverted in 3ebb3e1 because of what I assume was a bad merge conflict resolution. The field has contained an immutable object since its introduction in d25f5ac, so it is pretty likely to remain a constant in the future.
1 parent c506190 commit 04f1cc5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

xds/src/main/java/io/grpc/xds/XdsNameResolver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ final class XdsNameResolver extends NameResolver {
129129
private final long randomChannelId;
130130
private final MetricRecorder metricRecorder;
131131

132-
private volatile RoutingConfig routingConfig = RoutingConfig.empty;
132+
private volatile RoutingConfig routingConfig = RoutingConfig.EMPTY;
133133
private Listener2 listener;
134134
private ObjectPool<XdsClient> xdsClientPool;
135135
private XdsClient xdsClient;
@@ -856,7 +856,7 @@ private void cleanUpRoutes(String error) {
856856
}
857857
existingClusters = null;
858858
}
859-
routingConfig = RoutingConfig.empty;
859+
routingConfig = RoutingConfig.EMPTY;
860860
// Without addresses the default LB (normally pick_first) should become TRANSIENT_FAILURE, and
861861
// the config selector handles the error message itself. Once the LB API allows providing
862862
// failure information for addresses yet still providing a service config, the config seector
@@ -938,7 +938,7 @@ private static class RoutingConfig {
938938
private final long fallbackTimeoutNano;
939939
final ImmutableList<RouteData> routes;
940940

941-
private static RoutingConfig empty = new RoutingConfig(0, ImmutableList.of());
941+
private static final RoutingConfig EMPTY = new RoutingConfig(0, ImmutableList.of());
942942

943943
private RoutingConfig(long fallbackTimeoutNano, ImmutableList<RouteData> routes) {
944944
this.fallbackTimeoutNano = fallbackTimeoutNano;

0 commit comments

Comments
 (0)