Skip to content

Commit

Permalink
Address trivial review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
larry-safran committed Nov 6, 2024
1 parent 1169f39 commit 8d22cfd
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
3 changes: 1 addition & 2 deletions xds/src/main/java/io/grpc/xds/client/ControlPlaneClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ void adjustResourceSubscription(XdsResourceType<?> resourceType) {
return;
}

Collection<String> resources =
resourceStore.getSubscribedResources(serverInfo, resourceType);
Collection<String> resources = resourceStore.getSubscribedResources(serverInfo, resourceType);
if (resources == null) {
resources = Collections.emptyList();
}
Expand Down
2 changes: 0 additions & 2 deletions xds/src/main/java/io/grpc/xds/client/XdsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,5 @@ Collection<String> getSubscribedResources(
ServerInfo serverInfo, XdsResourceType<? extends ResourceUpdate> type);

Map<String, XdsResourceType<?>> getSubscribedResourceTypesWithTypeUrl();

boolean hasSubscribers(String authority);
}
}
6 changes: 3 additions & 3 deletions xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ public Collection<String> getSubscribedResources(
return retVal.isEmpty() ? null : retVal;
}

@Override
public boolean hasSubscribers(String authority) {
private boolean hasSubscribers(String authority) {
for (Map<String, ResourceSubscriber<? extends ResourceUpdate>> map
: resourceSubscribers.values()) {
for (ResourceSubscriber<? extends ResourceUpdate> subscriber : map.values()) {
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions xds/src/test/java/io/grpc/xds/ControlPlaneRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions xds/src/test/java/io/grpc/xds/CsdsServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,6 @@ public Collection<String> getSubscribedResources(
public Map<String, XdsResourceType<?>> getSubscribedResourceTypesWithTypeUrl() {
return ImmutableMap.of();
}

@Override
public boolean hasSubscribers(String authority) {
return true;
}
}

private static class FakeXdsClientPoolFactory implements XdsClientPoolFactory {
Expand Down

0 comments on commit 8d22cfd

Please sign in to comment.