mirror of https://github.com/grpc/grpc-java.git
xds: remove the env var GRPC_XDS_EXPERIMENTAL_NEW_SERVER_API (#7914)
This commit is contained in:
parent
6fb84bc61c
commit
bfc67bfcf4
|
|
@ -70,11 +70,10 @@ final class ServerXdsClient extends AbstractXdsClient {
|
||||||
ScheduledExecutorService timeService,
|
ScheduledExecutorService timeService,
|
||||||
BackoffPolicy.Provider backoffPolicyProvider,
|
BackoffPolicy.Provider backoffPolicyProvider,
|
||||||
Supplier<Stopwatch> stopwatchSupplier,
|
Supplier<Stopwatch> stopwatchSupplier,
|
||||||
boolean useNewApiForListenerQuery,
|
|
||||||
String instanceIp,
|
String instanceIp,
|
||||||
String grpcServerResourceId) {
|
String grpcServerResourceId) {
|
||||||
super(channel, useProtocolV3, node, timeService, backoffPolicyProvider, stopwatchSupplier);
|
super(channel, useProtocolV3, node, timeService, backoffPolicyProvider, stopwatchSupplier);
|
||||||
this.useNewApiForListenerQuery = useProtocolV3 && useNewApiForListenerQuery;
|
this.useNewApiForListenerQuery = useProtocolV3;
|
||||||
this.instanceIp = (instanceIp != null ? instanceIp : "0.0.0.0");
|
this.instanceIp = (instanceIp != null ? instanceIp : "0.0.0.0");
|
||||||
this.grpcServerResourceId = grpcServerResourceId;
|
this.grpcServerResourceId = grpcServerResourceId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,6 @@ public final class XdsClientWrapperForServerSds {
|
||||||
private static final TimeServiceResource timeServiceResource =
|
private static final TimeServiceResource timeServiceResource =
|
||||||
new TimeServiceResource("GrpcServerXdsClient");
|
new TimeServiceResource("GrpcServerXdsClient");
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
static boolean experimentalNewServerApiEnvVar = Boolean.parseBoolean(
|
|
||||||
System.getenv("GRPC_XDS_EXPERIMENTAL_NEW_SERVER_API"));
|
|
||||||
|
|
||||||
private EnvoyServerProtoData.Listener curListener;
|
private EnvoyServerProtoData.Listener curListener;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Nullable private XdsClient xdsClient;
|
@Nullable private XdsClient xdsClient;
|
||||||
|
|
@ -115,7 +111,7 @@ public final class XdsClientWrapperForServerSds {
|
||||||
Grpc.newChannelBuilder(serverInfo.getTarget(), serverInfo.getChannelCredentials())
|
Grpc.newChannelBuilder(serverInfo.getTarget(), serverInfo.getChannelCredentials())
|
||||||
.keepAliveTime(5, TimeUnit.MINUTES).build();
|
.keepAliveTime(5, TimeUnit.MINUTES).build();
|
||||||
timeService = SharedResourceHolder.get(timeServiceResource);
|
timeService = SharedResourceHolder.get(timeServiceResource);
|
||||||
newServerApi = serverInfo.isUseProtocolV3() && experimentalNewServerApiEnvVar;
|
newServerApi = serverInfo.isUseProtocolV3();
|
||||||
String grpcServerResourceId = bootstrapInfo.getGrpcServerResourceId();
|
String grpcServerResourceId = bootstrapInfo.getGrpcServerResourceId();
|
||||||
if (newServerApi && grpcServerResourceId == null) {
|
if (newServerApi && grpcServerResourceId == null) {
|
||||||
throw new IOException("missing grpc_server_resource_name_id value in xds bootstrap");
|
throw new IOException("missing grpc_server_resource_name_id value in xds bootstrap");
|
||||||
|
|
@ -128,7 +124,6 @@ public final class XdsClientWrapperForServerSds {
|
||||||
timeService,
|
timeService,
|
||||||
new ExponentialBackoffPolicy.Provider(),
|
new ExponentialBackoffPolicy.Provider(),
|
||||||
GrpcUtil.STOPWATCH_SUPPLIER,
|
GrpcUtil.STOPWATCH_SUPPLIER,
|
||||||
experimentalNewServerApiEnvVar,
|
|
||||||
"0.0.0.0",
|
"0.0.0.0",
|
||||||
grpcServerResourceId);
|
grpcServerResourceId);
|
||||||
start(xdsClientImpl);
|
start(xdsClientImpl);
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ public class ServerXdsClientNewServerApiTest {
|
||||||
xdsClient =
|
xdsClient =
|
||||||
new ServerXdsClient(channel, true, NODE,
|
new ServerXdsClient(channel, true, NODE,
|
||||||
fakeClock.getScheduledExecutorService(), backoffPolicyProvider,
|
fakeClock.getScheduledExecutorService(), backoffPolicyProvider,
|
||||||
fakeClock.getStopwatchSupplier(), true, INSTANCE_IP, "test/value");
|
fakeClock.getStopwatchSupplier(), INSTANCE_IP, "test/value");
|
||||||
// Only the connection to management server is established, no RPC request is sent until at
|
// Only the connection to management server is established, no RPC request is sent until at
|
||||||
// least one watcher is registered.
|
// least one watcher is registered.
|
||||||
assertThat(responseObservers).isEmpty();
|
assertThat(responseObservers).isEmpty();
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ public class ServerXdsClientTest {
|
||||||
xdsClient =
|
xdsClient =
|
||||||
new ServerXdsClient(channel, /* useProtocolV3= */ false, NODE,
|
new ServerXdsClient(channel, /* useProtocolV3= */ false, NODE,
|
||||||
fakeClock.getScheduledExecutorService(), backoffPolicyProvider,
|
fakeClock.getScheduledExecutorService(), backoffPolicyProvider,
|
||||||
fakeClock.getStopwatchSupplier(), false, INSTANCE_IP, "grpc/server");
|
fakeClock.getStopwatchSupplier(), INSTANCE_IP, "grpc/server");
|
||||||
// Only the connection to management server is established, no RPC request is sent until at
|
// Only the connection to management server is established, no RPC request is sent until at
|
||||||
// least one watcher is registered.
|
// least one watcher is registered.
|
||||||
assertThat(responseObservers).isEmpty();
|
assertThat(responseObservers).isEmpty();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue