Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 0 additions & 71 deletions api/src/main/java/io/grpc/ChannelConfigurator.java

This file was deleted.

7 changes: 0 additions & 7 deletions api/src/main/java/io/grpc/ForwardingChannelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,6 @@ public T disableServiceConfigLookUp() {
return thisT();
}


@Override
public T childChannelConfigurator(ChannelConfigurator channelConfigurator) {
delegate().childChannelConfigurator(channelConfigurator);
return thisT();
}

/**
* Returns the correctly typed version of the builder.
*/
Expand Down
7 changes: 0 additions & 7 deletions api/src/main/java/io/grpc/ForwardingChannelBuilder2.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,6 @@ public <X> T setNameResolverArg(NameResolver.Args.Key<X> key, X value) {
return thisT();
}


@Override
public T childChannelConfigurator(ChannelConfigurator channelConfigurator) {
delegate().childChannelConfigurator(channelConfigurator);
return thisT();
}

/**
* Returns the {@link ManagedChannel} built by the delegate by default. Overriding method can
* return different value.
Expand Down
17 changes: 0 additions & 17 deletions api/src/main/java/io/grpc/ManagedChannelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -666,23 +666,6 @@ public <X> T setNameResolverArg(NameResolver.Args.Key<X> key, X value) {
throw new UnsupportedOperationException();
}


/**
* Sets a configurator that will be applied to all internal child channels created by this
* channel.
*
* <p>This allows injecting universal configuration (like interceptors)
* into auxiliary channels created by gRPC infrastructure, such as xDS control plane connections.
*
* @param channelConfigurator the configurator to apply.
* @return this
* @since 1.83.0
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/12574")
public T childChannelConfigurator(ChannelConfigurator channelConfigurator) {
throw new UnsupportedOperationException("Not implemented");
}

/**
* Builds a channel using the given parameters.
*
Expand Down
25 changes: 0 additions & 25 deletions api/src/main/java/io/grpc/NameResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ public static final class Args {
private final MetricRecorder metricRecorder;
@Nullable private final NameResolverRegistry nameResolverRegistry;
@Nullable private final IdentityHashMap<Key<?>, Object> customArgs;
private final ChannelConfigurator channelConfigurator;

private Args(Builder builder) {
this.defaultPort = checkNotNull(builder.defaultPort, "defaultPort not set");
Expand All @@ -374,7 +373,6 @@ private Args(Builder builder) {
: new MetricRecorder() {};
this.nameResolverRegistry = builder.nameResolverRegistry;
this.customArgs = cloneCustomArgs(builder.customArgs);
this.channelConfigurator = builder.channelConfigurator;
}

/**
Expand Down Expand Up @@ -473,16 +471,6 @@ public ChannelLogger getChannelLogger() {
return channelLogger;
}

/**
* Returns the configurator for child channels.
*
* @since 1.83.0
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/12574")
public ChannelConfigurator getChildChannelConfigurator() {
return channelConfigurator;
}

/**
* Returns the Executor on which this resolver should execute long-running or I/O bound work.
* Null if no Executor was set.
Expand Down Expand Up @@ -561,7 +549,6 @@ public Builder toBuilder() {
builder.setOverrideAuthority(overrideAuthority);
builder.setMetricRecorder(metricRecorder);
builder.setNameResolverRegistry(nameResolverRegistry);
builder.setChildChannelConfigurator(channelConfigurator);
builder.customArgs = cloneCustomArgs(customArgs);
return builder;
}
Expand Down Expand Up @@ -592,7 +579,6 @@ public static final class Builder {
private MetricRecorder metricRecorder;
private NameResolverRegistry nameResolverRegistry;
private IdentityHashMap<Key<?>, Object> customArgs;
private ChannelConfigurator channelConfigurator = builder -> { };

Builder() {
}
Expand Down Expand Up @@ -708,17 +694,6 @@ public Builder setNameResolverRegistry(NameResolverRegistry registry) {
return this;
}

/**
* See {@link Args#getChildChannelConfigurator()}. This is an optional field.
*
* @since 1.83.0
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/12574")
public Builder setChildChannelConfigurator(ChannelConfigurator channelConfigurator) {
this.channelConfigurator = checkNotNull(channelConfigurator, "channelConfigurator");
return this;
}

/**
* Builds an {@link Args}.
*
Expand Down
42 changes: 0 additions & 42 deletions api/src/test/java/io/grpc/NameResolverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static org.mockito.Mockito.verify;

import com.google.common.base.Objects;
import io.grpc.ChannelConfigurator;
import io.grpc.NameResolver.ConfigOrError;
import io.grpc.NameResolver.Listener2;
import io.grpc.NameResolver.ResolutionResult;
Expand Down Expand Up @@ -73,8 +72,6 @@ public class NameResolverTest {
private final int customArgValue = 42;
@Mock NameResolver.Listener mockListener;

private final ChannelConfigurator channelConfigurator = builder -> { };

@Test
public void args() {
NameResolver.Args args = createArgs();
Expand All @@ -87,7 +84,6 @@ public void args() {
assertThat(args.getOffloadExecutor()).isSameInstanceAs(executor);
assertThat(args.getOverrideAuthority()).isSameInstanceAs(overrideAuthority);
assertThat(args.getMetricRecorder()).isSameInstanceAs(metricRecorder);
assertThat(args.getChildChannelConfigurator()).isSameInstanceAs(channelConfigurator);
assertThat(args.getArg(FOO_ARG_KEY)).isEqualTo(customArgValue);
assertThat(args.getArg(BAR_ARG_KEY)).isNull();

Expand All @@ -101,7 +97,6 @@ public void args() {
assertThat(args2.getOffloadExecutor()).isSameInstanceAs(executor);
assertThat(args2.getOverrideAuthority()).isSameInstanceAs(overrideAuthority);
assertThat(args.getMetricRecorder()).isSameInstanceAs(metricRecorder);
assertThat(args2.getChildChannelConfigurator()).isSameInstanceAs(channelConfigurator);
assertThat(args.getArg(FOO_ARG_KEY)).isEqualTo(customArgValue);
assertThat(args.getArg(BAR_ARG_KEY)).isNull();

Expand All @@ -120,47 +115,10 @@ private NameResolver.Args createArgs() {
.setOffloadExecutor(executor)
.setOverrideAuthority(overrideAuthority)
.setMetricRecorder(metricRecorder)
.setChildChannelConfigurator(channelConfigurator)
.setArg(FOO_ARG_KEY, customArgValue)
.build();
}

@Test
public void args_childChannelConfigurator() {
final ManagedChannelBuilder<?>[] capturedBuilder = new ManagedChannelBuilder<?>[1];
ChannelConfigurator channelConfigurator = new ChannelConfigurator() {
@Override
public void configureChannelBuilder(ManagedChannelBuilder<?> builder) {
capturedBuilder[0] = builder;
}
};

SynchronizationContext realSyncContext = new SynchronizationContext(
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
throw new AssertionError(e);
}
});

NameResolver.Args args = NameResolver.Args.newBuilder()
.setDefaultPort(8080)
.setProxyDetector(mock(ProxyDetector.class))
.setSynchronizationContext(realSyncContext)
.setServiceConfigParser(mock(NameResolver.ServiceConfigParser.class))
.setChannelLogger(mock(ChannelLogger.class))
.setChildChannelConfigurator(channelConfigurator)
.build();

ChannelConfigurator configurator = args.getChildChannelConfigurator();
assertThat(configurator).isSameInstanceAs(channelConfigurator);

// Validate configurator accepts builders
ManagedChannelBuilder<?> mockBuilder = mock(ManagedChannelBuilder.class);
configurator.configureChannelBuilder(mockBuilder);
assertThat(capturedBuilder[0]).isSameInstanceAs(mockBuilder);
}

@Test
@SuppressWarnings("deprecation")
public void startOnOldListener_wrapperListener2UsedToStart() {
Expand Down
19 changes: 1 addition & 18 deletions core/src/main/java/io/grpc/internal/ManagedChannelImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import io.grpc.CallCredentials;
import io.grpc.CallOptions;
import io.grpc.Channel;
import io.grpc.ChannelConfigurator;
import io.grpc.ChannelCredentials;
import io.grpc.ChannelLogger;
import io.grpc.ChannelLogger.ChannelLogLevel;
Expand Down Expand Up @@ -156,14 +155,6 @@ public Result selectConfig(PickSubchannelArgs args) {
private static final LoadBalancer.PickDetailsConsumer NOOP_PICK_DETAILS_CONSUMER =
new LoadBalancer.PickDetailsConsumer() {};

/**
* Retrieves the user-provided configuration function for internal child channels.
*
* <p>This is intended for use by gRPC internal components
* that are responsible for creating auxiliary {@code ManagedChannel} instances.
*/
private final ChannelConfigurator channelConfigurator;

private final InternalLogId logId;
private final String target;
@Nullable
Expand Down Expand Up @@ -554,8 +545,6 @@ ClientStream newSubstream(
Supplier<Stopwatch> stopwatchSupplier,
List<ClientInterceptor> interceptors,
final TimeProvider timeProvider) {
this.channelConfigurator = checkNotNull(builder.channelConfigurator,
"channelConfigurator");
this.target = checkNotNull(builder.target, "target");
this.logId = InternalLogId.allocate("Channel", target);
this.timeProvider = checkNotNull(timeProvider, "timeProvider");
Expand Down Expand Up @@ -600,8 +589,7 @@ ClientStream newSubstream(
.setOffloadExecutor(this.offloadExecutorHolder)
.setOverrideAuthority(this.authorityOverride)
.setMetricRecorder(this.metricRecorder)
.setNameResolverRegistry(builder.nameResolverRegistry)
.setChildChannelConfigurator(this.channelConfigurator);
.setNameResolverRegistry(builder.nameResolverRegistry);
builder.copyAllNameResolverCustomArgsTo(nameResolverArgsBuilder);
this.nameResolverArgs = nameResolverArgsBuilder.build();
this.nameResolver = getNameResolver(
Expand Down Expand Up @@ -1501,11 +1489,6 @@ protected ManagedChannelBuilder<?> delegate() {

ResolvingOobChannelBuilder builder = new ResolvingOobChannelBuilder();

// Note that we follow the global configurator pattern and try to fuse the configurations as
// soon as the builder gets created
channelConfigurator.configureChannelBuilder(builder);
builder.childChannelConfigurator(channelConfigurator);

return builder
// TODO(zdapeng): executors should not outlive the parent channel.
.executor(executor)
Expand Down
11 changes: 0 additions & 11 deletions core/src/main/java/io/grpc/internal/ManagedChannelImplBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import io.grpc.CallCredentials;
import io.grpc.CallOptions;
import io.grpc.Channel;
import io.grpc.ChannelConfigurator;
import io.grpc.ChannelCredentials;
import io.grpc.ClientCall;
import io.grpc.ClientInterceptor;
Expand Down Expand Up @@ -150,8 +149,6 @@ public static ManagedChannelBuilder<?> forTarget(String target) {
}


ChannelConfigurator channelConfigurator = builder -> { };

ObjectPool<? extends Executor> executorPool = DEFAULT_EXECUTOR_POOL;

ObjectPool<? extends Executor> offloadExecutorPool = DEFAULT_EXECUTOR_POOL;
Expand Down Expand Up @@ -759,14 +756,6 @@ protected ManagedChannelImplBuilder addMetricSink(MetricSink metricSink) {
return this;
}

@Override
public ManagedChannelImplBuilder childChannelConfigurator(
ChannelConfigurator channelConfigurator) {
this.channelConfigurator = checkNotNull(channelConfigurator,
"childChannelConfigurator");
return this;
}

@Override
public ManagedChannel build() {
ClientTransportFactory clientTransportFactory =
Expand Down
Loading
Loading