Skip to content
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

add examples of name resolve and load balance #9700

Merged
merged 4 commits into from Dec 1, 2022

Conversation

Smityz
Copy link
Contributor

@Smityz Smityz commented Nov 18, 2022

Ref: #9691
I add an example of name resolve and load balance.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 18, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@Smityz
Copy link
Contributor Author

Smityz commented Nov 18, 2022

WARNING: RPC failed: Status{code=INTERNAL, description=Panic! This is a bug!, cause=java.lang.IllegalStateException: Could not find policy 'round_robin'. Make sure its implementation is either registered to LoadBalancerRegistry or included in META-INF/services/io.grpc.LoadBalancerProvider from your jar files.
        at io.grpc.internal.AutoConfiguredLoadBalancerFactory$AutoConfiguredLoadBalancer.<init>(AutoConfiguredLoadBalancerFactory.java:94)
        at io.grpc.internal.AutoConfiguredLoadBalancerFactory.newLoadBalancer(AutoConfiguredLoadBalancerFactory.java:61)
        at io.grpc.internal.ManagedChannelImpl.exitIdleMode(ManagedChannelImpl.java:412)
        at io.grpc.internal.ManagedChannelImpl$RealChannel$2.run(ManagedChannelImpl.java:981)
        at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
        at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
        at io.grpc.internal.ManagedChannelImpl$RealChannel.newCall(ManagedChannelImpl.java:978)
        at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:920)
        at io.grpc.internal.ForwardingManagedChannel.newCall(ForwardingManagedChannel.java:63)
        at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:150)
        at io.grpc.examples.helloworld.GreeterGrpc$GreeterBlockingStub.sayHello(GreeterGrpc.java:157)
        at io.grpc.examples.loadbalance.LoadBalanceClient.greet(LoadBalanceClient.java:45)
        at io.grpc.examples.loadbalance.LoadBalanceClient.main(LoadBalanceClient.java:65)

This error happened when I use LoadBalanceClient which was compiled by Bazel, but Maven and Gradle are normal, I don't know how to fix it, can someone give a help?

@temawi
Copy link
Contributor

temawi commented Nov 28, 2022

Sorry for the delay in reviewing this! It's looking great, thanks for the extra effort to have it match the Go implementation.

Could we do one more change to have it match Go even closer? If you look at the Go codebase they have split this into two independent examples, "name_resolving" and "load_balancing". The idea is that a user wanting to just understand load balancing does not get confused with custom name resolution code and think they have to implement that as well.

You may have been hesitant to split the examples because both examples use the same server code, but in this case it would be fine to just copy the same implementation to both examples.

@temawi temawi added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Dec 1, 2022
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Dec 1, 2022
@temawi
Copy link
Contributor

temawi commented Dec 1, 2022

Thank you @Smityz this looks great!

@temawi temawi merged commit 9dac8cf into grpc:master Dec 1, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants