Skip to content

Commit 113d7b8

Browse files
committed
Checkpoint More fixes from rebasing
1 parent d73c842 commit 113d7b8

File tree

5 files changed

+10
-40
lines changed

5 files changed

+10
-40
lines changed

xds/src/main/java/io/grpc/xds/client/ControlPlaneClient.java

-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ void adjustResourceSubscription(XdsResourceType<?> resourceType) {
164164
resources = Collections.emptyList();
165165
}
166166
adsStream.sendDiscoveryRequest(resourceType, resources);
167-
resourceStore.startMissingResourceTimers(resources, resourceType);
168-
169167
if (resources.isEmpty()) {
170168
// The resource type no longer has subscribing resources; clean up references to it
171169
versions.remove(resourceType);

xds/src/main/java/io/grpc/xds/client/XdsClient.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -420,19 +420,12 @@ interface XdsResponseHandler {
420420
/** Called when a xds response is received. */
421421
void handleResourceResponse(
422422
XdsResourceType<?> resourceType, ServerInfo serverInfo, String versionInfo,
423-
List<Any> resources, String nonce, ProcessingTracker processingTracker);
423+
List<Any> resources, String nonce, boolean isFirstResponse,
424+
ProcessingTracker processingTracker);
424425

425426
/** Called when the ADS stream is closed passively. */
426427
// Must be synchronized.
427428
void handleStreamClosed(Status error, boolean shouldTryFallback);
428-
429-
/** Called when the ADS stream has established communication with the xds server.
430-
* Is expected to manage the ControlPlanClients and cache updates associated with
431-
* Moving to or from a fallback server.
432-
*
433-
* <p>Must be synchronized.
434-
*/
435-
void handleStreamRestarted(ServerInfo serverInfo);
436429
}
437430

438431
public interface ResourceStore {

xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java

-14
Original file line numberDiff line numberDiff line change
@@ -201,20 +201,6 @@ public Collection<String> getSubscribedResources(
201201
return retVal.isEmpty() ? null : retVal;
202202
}
203203

204-
@Override
205-
public void startMissingResourceTimers(Collection<String> resourceNames,
206-
XdsResourceType<?> resourceType) {
207-
Map<String, ResourceSubscriber<? extends ResourceUpdate>> subscriberMap =
208-
resourceSubscribers.get(resourceType);
209-
210-
for (String resourceName : resourceNames) {
211-
ResourceSubscriber<?> subscriber = subscriberMap.get(resourceName);
212-
if (subscriber.respTimer == null && !subscriber.hasResult()) {
213-
subscriber.restartTimer();
214-
}
215-
}
216-
}
217-
218204
// As XdsClient APIs becomes resource agnostic, subscribed resource types are dynamic.
219205
// ResourceTypes that do not have subscribers does not show up in the snapshot keys.
220206
@Override

xds/src/test/java/io/grpc/xds/ControlPlaneRule.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,11 @@ public class ControlPlaneRule extends TestWatcher {
8989
private XdsTestControlPlaneService controlPlaneService;
9090
private XdsTestLoadReportingService loadReportingService;
9191
private XdsNameResolverProvider nameResolverProvider;
92-
private final int port;
92+
private int port; // Only change from 0 to actual port used in the server.
9393

9494
public ControlPlaneRule() {
95-
this(0);
96-
}
97-
98-
public ControlPlaneRule(int port) {
9995
serverHostName = "test-server";
100-
this.port = port;
96+
this.port = 0;
10197
}
10298

10399
public ControlPlaneRule setServerHostName(String serverHostName) {
@@ -153,9 +149,9 @@ public Server getServer() {
153149
* Will shutdown existing server if needed.
154150
* Then creates a new server in the same way as {@link #starting(Description)} and starts it.
155151
*/
156-
public void restartTdServer() {
152+
public void restartXdsServer() {
157153

158-
if (getServer() != null && !getServer().isShutdown()) {
154+
if (getServer() != null && !getServer().isTerminated()) {
159155
getServer().shutdownNow();
160156
try {
161157
if (!getServer().awaitTermination(5, TimeUnit.SECONDS)) {
@@ -179,6 +175,10 @@ private void createAndStartXdsServer() throws IOException {
179175
.addService(loadReportingService)
180176
.build()
181177
.start();
178+
179+
if (port == 0) {
180+
port = server.getPort();
181+
}
182182
}
183183

184184
/**

xds/src/test/java/io/grpc/xds/CsdsServiceTest.java

-7
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,6 @@ public Collection<String> getSubscribedResources(
503503
return null;
504504
}
505505

506-
@Override
507-
public void startMissingResourceTimers(Collection<String> resourceNames,
508-
XdsResourceType<?> resourceType) {
509-
// do nothing
510-
}
511-
512506
@Override
513507
public Map<String, XdsResourceType<?>> getSubscribedResourceTypesWithTypeUrl() {
514508
return ImmutableMap.of();
@@ -559,7 +553,6 @@ public void setBootstrapOverride(Map<String, ?> bootstrap) {
559553
throw new UnsupportedOperationException("Should not be called");
560554
}
561555

562-
563556
@Override
564557
public ObjectPool<XdsClient> getOrCreate(String target, MetricRecorder metricRecorder) {
565558
throw new UnsupportedOperationException("Should not be called");

0 commit comments

Comments
 (0)