|
86 | 86 | import com.google.common.base.Function;
|
87 | 87 | import com.google.common.base.MoreObjects;
|
88 | 88 | import com.google.common.base.Preconditions;
|
89 |
| -import com.google.common.base.Supplier; |
90 |
| -import com.google.common.base.Suppliers; |
91 | 89 | import com.google.common.collect.ImmutableList;
|
92 | 90 | import com.google.common.collect.ImmutableMap;
|
93 | 91 | import com.google.common.collect.ImmutableSet;
|
@@ -239,6 +237,7 @@ public class GapicSpannerRpc implements SpannerRpc {
|
239 | 237 | private static final String CLIENT_LIBRARY_LANGUAGE = "spanner-java";
|
240 | 238 | public static final String DEFAULT_USER_AGENT =
|
241 | 239 | CLIENT_LIBRARY_LANGUAGE + "/" + GaxProperties.getLibraryVersion(GapicSpannerRpc.class);
|
| 240 | + public static boolean DIRECTPATH_CHANNEL_CREATED = false; |
242 | 241 | private static final String API_FILE = "grpc-gcp-apiconfig.json";
|
243 | 242 |
|
244 | 243 | private boolean rpcIsClosed;
|
@@ -281,8 +280,6 @@ public class GapicSpannerRpc implements SpannerRpc {
|
281 | 280 | private final int numChannels;
|
282 | 281 | private final boolean isGrpcGcpExtensionEnabled;
|
283 | 282 |
|
284 |
| - private Supplier<Boolean> directPathEnabledSupplier = () -> false; |
285 |
| - |
286 | 283 | private final GrpcCallContext baseGrpcCallContext;
|
287 | 284 |
|
288 | 285 | public static GapicSpannerRpc create(SpannerOptions options) {
|
@@ -361,9 +358,7 @@ public GapicSpannerRpc(final SpannerOptions options) {
|
361 | 358 | SpannerInterceptorProvider.create(
|
362 | 359 | MoreObjects.firstNonNull(
|
363 | 360 | options.getInterceptorProvider(),
|
364 |
| - SpannerInterceptorProvider.createDefault( |
365 |
| - options.getOpenTelemetry(), |
366 |
| - (() -> directPathEnabledSupplier.get())))) |
| 361 | + SpannerInterceptorProvider.createDefault(options.getOpenTelemetry()))) |
367 | 362 | // This sets the trace context headers.
|
368 | 363 | .withTraceContext(endToEndTracingEnabled, options.getOpenTelemetry())
|
369 | 364 | // This sets the response compressor (Server -> Client).
|
@@ -425,12 +420,9 @@ public GapicSpannerRpc(final SpannerOptions options) {
|
425 | 420 | this.spannerStub =
|
426 | 421 | GrpcSpannerStubWithStubSettingsAndClientContext.create(
|
427 | 422 | spannerStubSettings, clientContext);
|
428 |
| - this.directPathEnabledSupplier = |
429 |
| - Suppliers.memoize( |
430 |
| - () -> { |
431 |
| - return ((GrpcTransportChannel) clientContext.getTransportChannel()).isDirectPath() |
432 |
| - && isAttemptDirectPathXds; |
433 |
| - }); |
| 423 | + DIRECTPATH_CHANNEL_CREATED = |
| 424 | + ((GrpcTransportChannel) clientContext.getTransportChannel()).isDirectPath() |
| 425 | + && isAttemptDirectPathXds; |
434 | 426 | this.readRetrySettings =
|
435 | 427 | options.getSpannerStubSettings().streamingReadSettings().getRetrySettings();
|
436 | 428 | this.readRetryableCodes =
|
|
0 commit comments