diff --git a/xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java b/xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java index 2782af06825..7edc4c507af 100644 --- a/xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java +++ b/xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java @@ -63,7 +63,7 @@ protected BootstrapperImpl() { } // Delayed initialization of xdsFallbackEnabled to allow for flag initialization. - public static boolean isEnabledXdsFallback() { + private static boolean isEnabledXdsFallback() { return GrpcUtil.getFlag(GRPC_EXPERIMENTAL_XDS_FALLBACK, false); } diff --git a/xds/src/main/java/io/grpc/xds/client/ControlPlaneClient.java b/xds/src/main/java/io/grpc/xds/client/ControlPlaneClient.java index 8eef9fcc16e..51d3720e28a 100644 --- a/xds/src/main/java/io/grpc/xds/client/ControlPlaneClient.java +++ b/xds/src/main/java/io/grpc/xds/client/ControlPlaneClient.java @@ -160,8 +160,7 @@ void adjustResourceSubscription(XdsResourceType resourceType) { return; } - Collection resources = - resourceStore.getSubscribedResources(serverInfo, resourceType); + Collection resources = resourceStore.getSubscribedResources(serverInfo, resourceType); if (resources == null) { resources = Collections.emptyList(); } diff --git a/xds/src/main/java/io/grpc/xds/client/XdsClient.java b/xds/src/main/java/io/grpc/xds/client/XdsClient.java index e619fcb3d51..8b6ecfb1c53 100644 --- a/xds/src/main/java/io/grpc/xds/client/XdsClient.java +++ b/xds/src/main/java/io/grpc/xds/client/XdsClient.java @@ -427,7 +427,5 @@ Collection getSubscribedResources( ServerInfo serverInfo, XdsResourceType type); Map> getSubscribedResourceTypesWithTypeUrl(); - - boolean hasSubscribers(String authority); } } diff --git a/xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java b/xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java index fd820826f42..678d28ef81c 100644 --- a/xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java +++ b/xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java @@ -198,8 +198,7 @@ public Collection getSubscribedResources( return retVal.isEmpty() ? null : retVal; } - @Override - public boolean hasSubscribers(String authority) { + private boolean hasSubscribers(String authority) { for (Map> map : resourceSubscribers.values()) { for (ResourceSubscriber subscriber : map.values()) { @@ -1048,11 +1047,12 @@ && doFallbackForAuthority( @Override public void handleStreamRestarted(ServerInfo serverInfo) { + syncContext.throwIfNotInThisSynchronizationContext(); + if (isShutDown()) { return; } - syncContext.throwIfNotInThisSynchronizationContext(); ControlPlaneClient controlPlaneClient = serverCpClientMap.get(serverInfo); if (controlPlaneClient == null) { return; diff --git a/xds/src/test/java/io/grpc/xds/ControlPlaneRule.java b/xds/src/test/java/io/grpc/xds/ControlPlaneRule.java index babf3d8358f..5421504b35b 100644 --- a/xds/src/test/java/io/grpc/xds/ControlPlaneRule.java +++ b/xds/src/test/java/io/grpc/xds/ControlPlaneRule.java @@ -122,7 +122,7 @@ public Server getServer() { try { controlPlaneService = new XdsTestControlPlaneService(); loadReportingService = new XdsTestLoadReportingService(); - createAndStartTdServer(); + createAndStartXdsServer(); } catch (Exception e) { throw new AssertionError("unable to start the control plane server", e); } @@ -165,13 +165,13 @@ public void restartTdServer() { } try { - createAndStartTdServer(); + createAndStartXdsServer(); } catch (Exception e) { throw new AssertionError("unable to restart the control plane server", e); } } - private void createAndStartTdServer() throws IOException { + private void createAndStartXdsServer() throws IOException { server = Grpc.newServerBuilderForPort(port, InsecureServerCredentials.create()) .addService(controlPlaneService) .addService(loadReportingService) diff --git a/xds/src/test/java/io/grpc/xds/CsdsServiceTest.java b/xds/src/test/java/io/grpc/xds/CsdsServiceTest.java index 4fb4893046c..867a9590b4f 100644 --- a/xds/src/test/java/io/grpc/xds/CsdsServiceTest.java +++ b/xds/src/test/java/io/grpc/xds/CsdsServiceTest.java @@ -506,11 +506,6 @@ public Collection getSubscribedResources( public Map> getSubscribedResourceTypesWithTypeUrl() { return ImmutableMap.of(); } - - @Override - public boolean hasSubscribers(String authority) { - return true; - } } private static class FakeXdsClientPoolFactory implements XdsClientPoolFactory {