Skip to content

Commit eab10a9

Browse files
committed
fix: pass the configurer
1 parent 3259d67 commit eab10a9

33 files changed

Lines changed: 206 additions & 596 deletions

api/src/main/java/io/grpc/ChildChannelConfigurer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2025 The gRPC Authors
2+
* Copyright 2026 The gRPC Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -60,8 +60,8 @@ public interface ChildChannelConfigurer extends Consumer<ManagedChannelBuilder<?
6060
* before {@link ManagedChannelBuilder#build()} is called.
6161
*
6262
* <p>Note: The provided {@code builder} is generic (`?`). Implementations should use
63-
* universal configuration methods (like {@code intercept()}, {@code userAgent()}) rather
64-
* than casting to specific implementation types.
63+
* universal configuration methods (like {@code intercept()}, {@code userAgent()}) on the
64+
* builder rather than casting it to specific implementation types.
6565
*
6666
* @param builder the mutable channel builder for the new child channel
6767
*/

api/src/main/java/io/grpc/ChildChannelConfigurers.java

Lines changed: 0 additions & 99 deletions
This file was deleted.

api/src/main/java/io/grpc/ForwardingChannelBuilder.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,6 @@ public T disableServiceConfigLookUp() {
242242
return thisT();
243243
}
244244

245-
@Override
246-
public T configureChannel(ManagedChannel parentChannel) {
247-
delegate().configureChannel(parentChannel);
248-
return thisT();
249-
}
250-
251-
@Override
252-
public T configureChannel(Server parentServer) {
253-
delegate().configureChannel(parentServer);
254-
return thisT();
255-
}
256245

257246
@Override
258247
public T childChannelConfigurer(ChildChannelConfigurer childChannelConfigurer) {

api/src/main/java/io/grpc/ForwardingChannelBuilder2.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,6 @@ public <X> T setNameResolverArg(NameResolver.Args.Key<X> key, X value) {
269269
return thisT();
270270
}
271271

272-
@Override
273-
public T configureChannel(ManagedChannel parentChannel) {
274-
delegate().configureChannel(parentChannel);
275-
return thisT();
276-
}
277-
278-
@Override
279-
public T configureChannel(Server parentServer) {
280-
delegate().configureChannel(parentServer);
281-
return thisT();
282-
}
283272

284273
@Override
285274
public T childChannelConfigurer(ChildChannelConfigurer childChannelConfigurer) {

api/src/main/java/io/grpc/ForwardingServerBuilder.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,6 @@ public T setBinaryLog(BinaryLog binaryLog) {
192192
return thisT();
193193
}
194194

195-
@Override
196-
public T configureChannel(Server parentServer) {
197-
delegate().configureChannel(parentServer);
198-
return thisT();
199-
}
200-
201195
@Override
202196
public T childChannelConfigurer(ChildChannelConfigurer childChannelConfigurer) {
203197
delegate().childChannelConfigurer(childChannelConfigurer);

api/src/main/java/io/grpc/ManagedChannel.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,6 @@ public ConnectivityState getState(boolean requestConnection) {
8585
throw new UnsupportedOperationException("Not implemented");
8686
}
8787

88-
/**
89-
* Returns the configurer for child channels.
90-
*
91-
* <p>This method is intended for use by the internal gRPC infrastructure (specifically
92-
* load balancers and the channel builder) to propagate configuration to child channels.
93-
* Application code should not call this method.
94-
*
95-
* @return the configurer, or {@code noOp()} if none is set.
96-
* @since 1.79.0
97-
*/
98-
@Internal
99-
public ChildChannelConfigurer getChildChannelConfigurer() {
100-
// Return noOP() by default so we don't break existing custom ManagedChannel implementations
101-
// (like wrappers or mocks) that don't override this method.
102-
return ChildChannelConfigurers.noOp();
103-
}
104-
10588
/**
10689
* Registers a one-off callback that will be run if the connectivity state of the channel diverges
10790
* from the given {@code source}, which is typically what has just been returned by {@link

api/src/main/java/io/grpc/ManagedChannelBuilder.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -657,37 +657,6 @@ public <X> T setNameResolverArg(NameResolver.Args.Key<X> key, X value) {
657657
throw new UnsupportedOperationException();
658658
}
659659

660-
/**
661-
* Configures this builder using settings derived from an existing parent channel.
662-
*
663-
* <p>This method is typically used by internal components (like LoadBalancers) when creating
664-
* child channels to ensure they inherit relevant configuration (like the
665-
* {@link ChildChannelConfigurer}) from the parent.
666-
*
667-
* @param parentChannel the channel to inherit configuration from
668-
* @return this
669-
* @since 1.79.0
670-
*/
671-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/12574")
672-
public T configureChannel(ManagedChannel parentChannel) {
673-
throw new UnsupportedOperationException();
674-
}
675-
676-
/**
677-
* Configures this builder using settings derived from an existing parent server.
678-
*
679-
* <p>This method is typically used by internal components (like LoadBalancers) when creating
680-
* child channels to ensure they inherit relevant configuration (like the
681-
* {@link ChildChannelConfigurer}) from the parent.
682-
*
683-
* @param parentServer the server to inherit configuration from
684-
* @return this
685-
* @since 1.79.0
686-
*/
687-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/12574")
688-
public T configureChannel(Server parentServer) {
689-
throw new UnsupportedOperationException();
690-
}
691660

692661
/**
693662
* Sets a configurer that will be applied to all internal child channels created by this channel.

api/src/main/java/io/grpc/NameResolver.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public static final class Args {
323323
@Nullable private final MetricRecorder metricRecorder;
324324
@Nullable private final NameResolverRegistry nameResolverRegistry;
325325
@Nullable private final IdentityHashMap<Key<?>, Object> customArgs;
326-
@Nullable private final ManagedChannel parentChannel;
326+
@Nullable private final ChildChannelConfigurer childChannelConfigurer;
327327

328328
private Args(Builder builder) {
329329
this.defaultPort = checkNotNull(builder.defaultPort, "defaultPort not set");
@@ -338,7 +338,7 @@ private Args(Builder builder) {
338338
this.metricRecorder = builder.metricRecorder;
339339
this.nameResolverRegistry = builder.nameResolverRegistry;
340340
this.customArgs = cloneCustomArgs(builder.customArgs);
341-
this.parentChannel = builder.parentChannel;
341+
this.childChannelConfigurer = builder.childChannelConfigurer;
342342
}
343343

344344
/**
@@ -438,11 +438,14 @@ public ChannelLogger getChannelLogger() {
438438
}
439439

440440
/**
441-
* Returns the parent {@link ManagedChannel} served by this NameResolver.
441+
* Returns the configurer for child channels.
442+
*
443+
* @since 1.81.0
442444
*/
445+
@Nullable
443446
@Internal
444-
public ManagedChannel getParentChannel() {
445-
return parentChannel;
447+
public ChildChannelConfigurer getChildChannelConfigurer() {
448+
return childChannelConfigurer;
446449
}
447450

448451
/**
@@ -554,7 +557,7 @@ public static final class Builder {
554557
private MetricRecorder metricRecorder;
555558
private NameResolverRegistry nameResolverRegistry;
556559
private IdentityHashMap<Key<?>, Object> customArgs;
557-
private ManagedChannel parentChannel;
560+
private ChildChannelConfigurer childChannelConfigurer;
558561

559562
Builder() {
560563
}
@@ -671,12 +674,12 @@ public Builder setNameResolverRegistry(NameResolverRegistry registry) {
671674
}
672675

673676
/**
674-
* See {@link Args#parentChannel}. This is an optional field.
677+
* See {@link Args#getChildChannelConfigurer()}. This is an optional field.
675678
*
676-
* @since 1.79.0
679+
* @since 1.81.0
677680
*/
678-
public Builder setParentChannel(ManagedChannel parentChannel) {
679-
this.parentChannel = parentChannel;
681+
public Builder setChildChannelConfigurer(ChildChannelConfigurer childChannelConfigurer) {
682+
this.childChannelConfigurer = childChannelConfigurer;
680683
return this;
681684
}
682685

api/src/main/java/io/grpc/Server.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,4 @@ public List<ServerServiceDefinition> getMutableServices() {
179179
*/
180180
public abstract void awaitTermination() throws InterruptedException;
181181

182-
/**
183-
* Returns the configurer for child channels.
184-
*
185-
* <p>This method is intended for use by the internal gRPC infrastructure
186-
* to propagate configuration to child channels.
187-
* Application code should not call this method.
188-
*
189-
* @return the configurer, or {@code noOp()} if none is set.
190-
* @since 1.79.0
191-
*/
192-
@Internal
193-
public ChildChannelConfigurer getChildChannelConfigurer() {
194-
// Return noOp() by default so we don't break existing custom ManagedChannel implementations
195-
// (like wrappers or mocks) that don't override this method.
196-
return ChildChannelConfigurers.noOp();
197-
}
198182
}

api/src/main/java/io/grpc/ServerBuilder.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -424,21 +424,6 @@ public T setBinaryLog(BinaryLog binaryLog) {
424424
throw new UnsupportedOperationException();
425425
}
426426

427-
/**
428-
* Configures this builder using settings derived from an existing parent server.
429-
*
430-
* <p>This method is typically used by internal components when creating
431-
* child channels to ensure they inherit relevant configuration (like the
432-
* {@link ChildChannelConfigurer}) from the parent.
433-
*
434-
* @param parentServer the server to inherit configuration from
435-
* @return this
436-
* @since 1.79.0
437-
*/
438-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/12574")
439-
public T configureChannel(Server parentServer) {
440-
throw new UnsupportedOperationException();
441-
}
442427

443428
/**
444429
* Sets a configurer that will be applied to all internal child channels created by this server.

0 commit comments

Comments
 (0)