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

Channel.authority() should return the value of overrideAuthority #2956

Merged
merged 12 commits into from
Apr 27, 2017

Conversation

zpencer
Copy link
Contributor

@zpencer zpencer commented Apr 27, 2017

AbstractManagedChannelImplBuilder accepts an overrideAuthority parameter, but this value is not hooked up to the name resolver object. Ultimately, Channel.authority consults with the NameResolver, so the overrideAuthority should be hooked into the NameResolverFactory, while all other functionality should be preserved.

Also, add unit tests for all the variants of OkHttpChannelBuilder and NettyChannelBuilder constructors, namely to test the slightly different NettyChannelBuilder(SocketAddress) code path.

Fixes #2682

@zpencer zpencer requested a review from ejona86 April 27, 2017 17:32
@ejona86
Copy link
Member

ejona86 commented Apr 27, 2017

FYI: most of the time we'll rebase instead of merging, and then squash before pushing to the master branch.

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the gradle-wrapper.jar change?

* functionality.
*/
@VisibleForTesting
protected static class OverrideAuthorityNameResolverFactory extends NameResolver.Factory {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package-private instead of protected?

@@ -308,6 +308,10 @@ public ManagedChannel build() {
// getResource(), then this shouldn't be a problem unless called on the UI thread.
nameResolverFactory = NameResolverProvider.asFactory();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete AuthorityOverridingTransportFactory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't realize that this was all that AuthorityOverridingTransportFactory was trying to accomplish. Done.


/**
* Constructor for the {@link NameResolver.Factory}
* @param delegate The actual underlying factory that will produce the a {@link NameResolver}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave an empty line before the section with @param and similar.

*/
@VisibleForTesting
protected static class OverrideAuthorityNameResolverFactory extends NameResolver.Factory {
final NameResolver.Factory delegate;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Private? Ditto for authorityOverride.


import java.net.InetSocketAddress;
import java.net.URI;
import java.util.concurrent.TimeUnit;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating extra sections here is the old style. Now there are only two sections: static imports and normal imports.

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to squash

@zpencer zpencer force-pushed the zpencer/2682/overrideAuthority branch from 1660ff7 to d6f0926 Compare April 27, 2017 20:45
@zpencer zpencer merged commit a317912 into grpc:master Apr 27, 2017
@zpencer zpencer deleted the zpencer/2682/overrideAuthority branch April 27, 2017 21:17
@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
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.

overrideAuthority does not impact authority for JWT in jwt_token_creds
2 participants