mirror of https://github.com/grpc/grpc-java.git
xds: move tlsContextManager (#10859)
Minor refactor to the tlsContextManager to not expose itself on the xdsClientImpl constructor. This is to allow people who plugins xdsTransportFactory to use the API easily.
This commit is contained in:
parent
c2a3792a04
commit
20abea47bc
|
|
@ -28,7 +28,6 @@ import io.grpc.internal.SharedResourceHolder;
|
||||||
import io.grpc.internal.TimeProvider;
|
import io.grpc.internal.TimeProvider;
|
||||||
import io.grpc.xds.Bootstrapper.BootstrapInfo;
|
import io.grpc.xds.Bootstrapper.BootstrapInfo;
|
||||||
import io.grpc.xds.XdsNameResolverProvider.XdsClientPoolFactory;
|
import io.grpc.xds.XdsNameResolverProvider.XdsClientPoolFactory;
|
||||||
import io.grpc.xds.internal.security.TlsContextManagerImpl;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
@ -130,8 +129,7 @@ final class SharedXdsClientPoolProvider implements XdsClientPoolFactory {
|
||||||
scheduler,
|
scheduler,
|
||||||
new ExponentialBackoffPolicy.Provider(),
|
new ExponentialBackoffPolicy.Provider(),
|
||||||
GrpcUtil.STOPWATCH_SUPPLIER,
|
GrpcUtil.STOPWATCH_SUPPLIER,
|
||||||
TimeProvider.SYSTEM_TIME_PROVIDER,
|
TimeProvider.SYSTEM_TIME_PROVIDER);
|
||||||
new TlsContextManagerImpl(bootstrapInfo));
|
|
||||||
}
|
}
|
||||||
refCount++;
|
refCount++;
|
||||||
return xdsClient;
|
return xdsClient;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ import io.grpc.xds.XdsClient.ResourceStore;
|
||||||
import io.grpc.xds.XdsClient.TimerLaunch;
|
import io.grpc.xds.XdsClient.TimerLaunch;
|
||||||
import io.grpc.xds.XdsClient.XdsResponseHandler;
|
import io.grpc.xds.XdsClient.XdsResponseHandler;
|
||||||
import io.grpc.xds.XdsLogger.XdsLogLevel;
|
import io.grpc.xds.XdsLogger.XdsLogLevel;
|
||||||
|
import io.grpc.xds.internal.security.TlsContextManagerImpl;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
@ -116,8 +117,7 @@ final class XdsClientImpl extends XdsClient
|
||||||
ScheduledExecutorService timeService,
|
ScheduledExecutorService timeService,
|
||||||
BackoffPolicy.Provider backoffPolicyProvider,
|
BackoffPolicy.Provider backoffPolicyProvider,
|
||||||
Supplier<Stopwatch> stopwatchSupplier,
|
Supplier<Stopwatch> stopwatchSupplier,
|
||||||
TimeProvider timeProvider,
|
TimeProvider timeProvider) {
|
||||||
TlsContextManager tlsContextManager) {
|
|
||||||
this.xdsTransportFactory = xdsTransportFactory;
|
this.xdsTransportFactory = xdsTransportFactory;
|
||||||
this.bootstrapInfo = bootstrapInfo;
|
this.bootstrapInfo = bootstrapInfo;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|
@ -125,7 +125,7 @@ final class XdsClientImpl extends XdsClient
|
||||||
this.backoffPolicyProvider = backoffPolicyProvider;
|
this.backoffPolicyProvider = backoffPolicyProvider;
|
||||||
this.stopwatchSupplier = stopwatchSupplier;
|
this.stopwatchSupplier = stopwatchSupplier;
|
||||||
this.timeProvider = timeProvider;
|
this.timeProvider = timeProvider;
|
||||||
this.tlsContextManager = checkNotNull(tlsContextManager, "tlsContextManager");
|
this.tlsContextManager = new TlsContextManagerImpl(bootstrapInfo);
|
||||||
logId = InternalLogId.allocate("xds-client", null);
|
logId = InternalLogId.allocate("xds-client", null);
|
||||||
logger = XdsLogger.withLogId(logId);
|
logger = XdsLogger.withLogId(logId);
|
||||||
logger.log(XdsLogLevel.INFO, "Created");
|
logger.log(XdsLogLevel.INFO, "Created");
|
||||||
|
|
|
||||||
|
|
@ -287,8 +287,6 @@ public abstract class XdsClientImplTestBase {
|
||||||
private ResourceWatcher<CdsUpdate> cdsResourceWatcher;
|
private ResourceWatcher<CdsUpdate> cdsResourceWatcher;
|
||||||
@Mock
|
@Mock
|
||||||
private ResourceWatcher<EdsUpdate> edsResourceWatcher;
|
private ResourceWatcher<EdsUpdate> edsResourceWatcher;
|
||||||
@Mock
|
|
||||||
private TlsContextManager tlsContextManager;
|
|
||||||
|
|
||||||
private ManagedChannel channel;
|
private ManagedChannel channel;
|
||||||
private ManagedChannel channelForCustomAuthority;
|
private ManagedChannel channelForCustomAuthority;
|
||||||
|
|
@ -374,8 +372,7 @@ public abstract class XdsClientImplTestBase {
|
||||||
fakeClock.getScheduledExecutorService(),
|
fakeClock.getScheduledExecutorService(),
|
||||||
backoffPolicyProvider,
|
backoffPolicyProvider,
|
||||||
fakeClock.getStopwatchSupplier(),
|
fakeClock.getStopwatchSupplier(),
|
||||||
timeProvider,
|
timeProvider);
|
||||||
tlsContextManager);
|
|
||||||
|
|
||||||
assertThat(resourceDiscoveryCalls).isEmpty();
|
assertThat(resourceDiscoveryCalls).isEmpty();
|
||||||
assertThat(loadReportCalls).isEmpty();
|
assertThat(loadReportCalls).isEmpty();
|
||||||
|
|
@ -3749,8 +3746,7 @@ public abstract class XdsClientImplTestBase {
|
||||||
fakeClock.getScheduledExecutorService(),
|
fakeClock.getScheduledExecutorService(),
|
||||||
backoffPolicyProvider,
|
backoffPolicyProvider,
|
||||||
fakeClock.getStopwatchSupplier(),
|
fakeClock.getStopwatchSupplier(),
|
||||||
timeProvider,
|
timeProvider);
|
||||||
tlsContextManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BootstrapInfo buildBootStrap(String serverUri) {
|
private BootstrapInfo buildBootStrap(String serverUri) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue