Skip to content

api: Remove deprecated SubchannelPicker.requestConnection() #12012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2025
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
12 changes: 0 additions & 12 deletions api/src/main/java/io/grpc/LoadBalancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -452,18 +452,6 @@ public abstract static class SubchannelPicker {
* @since 1.3.0
*/
public abstract PickResult pickSubchannel(PickSubchannelArgs args);

/**
* Tries to establish connections now so that the upcoming RPC may then just pick a ready
* connection without having to connect first.
*
* <p>No-op if unsupported.
*
* @deprecated override {@link LoadBalancer#requestConnection} instead.
* @since 1.11.0
*/
@Deprecated
public void requestConnection() {}
}

/**
Expand Down
13 changes: 1 addition & 12 deletions core/src/main/java/io/grpc/internal/ManagedChannelImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,6 @@ public void uncaughtException(Thread t, Throwable e) {
@Nullable
private LbHelperImpl lbHelper;

// Must ONLY be assigned from updateSubchannelPicker(), which is called from syncContext.
// null if channel is in idle mode.
@Nullable
private volatile SubchannelPicker subchannelPicker;

// Must be accessed from the syncContext
private boolean panicMode;

Expand All @@ -259,8 +254,7 @@ public void uncaughtException(Thread t, Throwable e) {
// Channel's shutdown process:
// 1. shutdown(): stop accepting new calls from applications
// 1a shutdown <- true
// 1b subchannelPicker <- null
// 1c delayedTransport.shutdown()
// 1b delayedTransport.shutdown()
// 2. delayedTransport terminated: stop stream-creation functionality
// 2a terminating <- true
// 2b loadBalancer.shutdown()
Expand Down Expand Up @@ -393,7 +387,6 @@ private void shutdownNameResolverAndLoadBalancer(boolean channelIsActive) {
lbHelper.lb.shutdown();
lbHelper = null;
}
subchannelPicker = null;
}

/**
Expand Down Expand Up @@ -804,7 +797,6 @@ boolean isInPanicMode() {

// Called from syncContext
private void updateSubchannelPicker(SubchannelPicker newPicker) {
subchannelPicker = newPicker;
delayedTransport.reprocess(newPicker);
}

Expand Down Expand Up @@ -1228,9 +1220,6 @@ final class RequestConnection implements Runnable {
@Override
public void run() {
exitIdleMode();
if (subchannelPicker != null) {
subchannelPicker.requestConnection();
}
if (lbHelper != null) {
lbHelper.lb.requestConnection();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2590,7 +2590,6 @@ public void getState_withRequestConnect_IdleWithLbRunning() {

assertEquals(IDLE, channel.getState(true));
verify(mockLoadBalancerProvider).newLoadBalancer(any(Helper.class));
verify(mockPicker).requestConnection();
verify(mockLoadBalancer).requestConnection();
}

Expand Down
5 changes: 0 additions & 5 deletions xds/src/main/java/io/grpc/xds/LazyLoadBalancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ public PickResult pickSubchannel(PickSubchannelArgs args) {
helper.getSynchronizationContext().execute(LazyDelegate.this::activate);
return PickResult.withNoResult();
}

@Override
public void requestConnection() {
helper.getSynchronizationContext().execute(LazyDelegate.this::requestConnection);
}
}
}

Expand Down