• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #20353

07 Jul 2026 10:24AM UTC coverage: 89.104% (-0.02%) from 89.122%
#20353

push

github

web-flow
enable child channel plugins (#12578)

Implements https://github.com/grpc/proposal/pull/529

38027 of 42677 relevant lines covered (89.1%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/../xds/src/main/java/io/grpc/xds/InternalSharedXdsClientPoolProvider.java
1
/*
2
 * Copyright 2022 The gRPC Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package io.grpc.xds;
18

19
import io.grpc.CallCredentials;
20
import io.grpc.ChannelConfigurator;
21
import io.grpc.Internal;
22
import io.grpc.MetricRecorder;
23
import io.grpc.internal.ObjectPool;
24
import io.grpc.xds.client.Bootstrapper.BootstrapInfo;
25
import io.grpc.xds.client.XdsClient;
26
import io.grpc.xds.client.XdsInitializationException;
27
import java.util.Map;
28

29
/**
30
 * Accessor for global factory for managing XdsClient instance.
31
 */
32
@Internal
33
public final class InternalSharedXdsClientPoolProvider {
34
  // Prevent instantiation
35
  private InternalSharedXdsClientPoolProvider() {}
36

37
  /**
38
   * Override the global bootstrap.
39
   *
40
   * @deprecated Use InternalGrpcBootstrapperImpl.parseBootstrap() and pass the result to
41
   *     getOrCreate().
42
   */
43
  @Deprecated
44
  public static void setDefaultProviderBootstrapOverride(Map<String, ?> bootstrap) {
45
    GrpcBootstrapperImpl.setDefaultBootstrapOverride(bootstrap);
×
46
  }
×
47

48
  /**
49
   * Get an XdsClient pool.
50
   *
51
   * @deprecated Use InternalGrpcBootstrapperImpl.parseBootstrap() and pass the result to the other
52
   *     getOrCreate().
53
   */
54
  @Deprecated
55
  public static ObjectPool<XdsClient> getOrCreate(String target)
56
      throws XdsInitializationException {
57
    return getOrCreate(target, new MetricRecorder() {});
×
58
  }
59

60
  /**
61
   * Get an XdsClient pool.
62
   *
63
   * @deprecated Use InternalGrpcBootstrapperImpl.parseBootstrap() and pass the result to the other
64
   *     getOrCreate().
65
   */
66
  @Deprecated
67
  public static ObjectPool<XdsClient> getOrCreate(String target, MetricRecorder metricRecorder)
68
      throws XdsInitializationException {
69
    return getOrCreate(target, metricRecorder, null);
×
70
  }
71

72
  /**
73
   * Get an XdsClient pool.
74
   *
75
   * @deprecated Use InternalGrpcBootstrapperImpl.parseBootstrap() and pass the result to the other
76
   *     getOrCreate().
77
   */
78
  @Deprecated
79
  public static ObjectPool<XdsClient> getOrCreate(
80
      String target, MetricRecorder metricRecorder, CallCredentials transportCallCredentials)
81
      throws XdsInitializationException {
82
    return SharedXdsClientPoolProvider.getDefaultProvider()
×
83
        .getOrCreate(target, metricRecorder, transportCallCredentials);
×
84
  }
85

86
  public static XdsClientResult getOrCreate(
87
      String target, BootstrapInfo bootstrapInfo, MetricRecorder metricRecorder,
88
      CallCredentials transportCallCredentials) {
89
    return getOrCreate(target, bootstrapInfo, metricRecorder, transportCallCredentials, null);
×
90
  }
91

92
  public static XdsClientResult getOrCreate(
93
      String target, BootstrapInfo bootstrapInfo, MetricRecorder metricRecorder,
94
      CallCredentials transportCallCredentials, ChannelConfigurator channelConfigurator) {
95
    return new XdsClientResult(SharedXdsClientPoolProvider.getDefaultProvider()
×
96
        .getOrCreate(target, bootstrapInfo, metricRecorder, transportCallCredentials,
×
97
            channelConfigurator));
98
  }
99

100
  /**
101
   * An ObjectPool, except without exposing io.grpc.internal, which must not be used for
102
   * cross-package APIs.
103
   */
104
  public static final class XdsClientResult {
105
    private final ObjectPool<XdsClient> xdsClientPool;
106

107
    XdsClientResult(ObjectPool<XdsClient> xdsClientPool) {
×
108
      this.xdsClientPool = xdsClientPool;
×
109
    }
×
110

111
    public XdsClient getObject() {
112
      return xdsClientPool.getObject();
×
113
    }
114

115
    public XdsClient returnObject(XdsClient xdsClient) {
116
      return xdsClientPool.returnObject(xdsClient);
×
117
    }
118
  }
119
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc