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
api,core: add LoadBalancer.Helper#createResolvingOobChannelBuilder api #7136
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ | |
import io.grpc.LoadBalancer.SubchannelPicker; | ||
import io.grpc.LoadBalancer.SubchannelStateListener; | ||
import io.grpc.ManagedChannel; | ||
import io.grpc.ManagedChannelBuilder; | ||
import io.grpc.Metadata; | ||
import io.grpc.MethodDescriptor; | ||
import io.grpc.NameResolver; | ||
|
@@ -1260,7 +1261,7 @@ public void run() { | |
} | ||
|
||
@Override | ||
public ManagedChannel createResolvingOobChannel(String target) { | ||
public ManagedChannelBuilder<?> createResolvingOobChannelBuilder(String target) { | ||
final class ResolvingOobChannelBuilder | ||
extends AbstractManagedChannelImplBuilder<ResolvingOobChannelBuilder> { | ||
int defaultPort = -1; | ||
|
@@ -1278,6 +1279,19 @@ public int getDefaultPort() { | |
protected ClientTransportFactory buildTransportFactory() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public ManagedChannel build() { | ||
// TODO(creamsoup) prevents main channel to shutdown if oob channel is not terminated | ||
creamsoup marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return new ManagedChannelImpl( | ||
this, | ||
transportFactory, | ||
backoffPolicyProvider, | ||
balancerRpcExecutorPool, | ||
stopwatchSupplier, | ||
Collections.<ClientInterceptor>emptyList(), | ||
timeProvider); | ||
} | ||
} | ||
|
||
checkState(!terminated, "Channel is terminated"); | ||
|
@@ -1291,15 +1305,12 @@ protected ClientTransportFactory buildTransportFactory() { | |
builder.proxyDetector = nameResolverArgs.getProxyDetector(); | ||
builder.defaultPort = nameResolverArgs.getDefaultPort(); | ||
builder.userAgent = userAgent; | ||
return | ||
new ManagedChannelImpl( | ||
builder, | ||
transportFactory, | ||
backoffPolicyProvider, | ||
balancerRpcExecutorPool, | ||
stopwatchSupplier, | ||
Collections.<ClientInterceptor>emptyList(), | ||
timeProvider); | ||
return builder; | ||
} | ||
|
||
@Override | ||
public ManagedChannel createResolvingOobChannel(String target) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you still need this overriding? Same for below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For below we definitely need. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. for the Forwarding one, i didn't change because the method is not final. |
||
return createResolvingOobChannelBuilder(target).build(); | ||
} | ||
|
||
@Override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the last sentence is not needed as well. Basically it will use the balancer determined by the service config from the NameResolver or the default config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, removed.