-
Notifications
You must be signed in to change notification settings - Fork 3.9k
create AuthorityOverridingTransportFactory instance only in need #1666
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
Conversation
…tyOverride is set
Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok to test. |
So this is an optimization? Could you make |
The CI is failing with a style violation. |
Yes, it is a small optimization. I agree with your suggestion:
I will do these and also fix the style violation. |
codecov/project — 83.33% (-0.03%) compared to 511bea0 at 83.36% I should write unit test case to increase the code coverage before you accept this pull request ? |
@skyao we love tests! :-). Out of curiosity, why is this "optimization" relevant? |
@skyao the codecov/project failure is fine; we can't yet define a tolerance, so the reduction isn't probably based on your change. And if we look at codecov/patch you've covered all the lines you changed. |
This LGTM. Could someone else do a review? |
buildTransportFactory(), authorityOverride); | ||
ClientTransportFactory transportFactory = buildTransportFactory(); | ||
if (authorityOverride != null) { | ||
transportFactory = new AuthorityOverridingTransportFactory(transportFactory, |
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.
wrap this line so that all the args on the second line.
A few nits. |
All comments had been accepted and code is updated to above comments, except the one that use static import for Preconditons.checkNotNull(). This is due to the fact that in this class there are some other Proconditions check but all of them don't use static import. I think we should keep the same style: use static or not for all the statements. Anyway, if you insist that for this one we should use static import, I will follow. |
@skyao LGTM, please squash your commits and I can merge. |
Following the convention of the file with checkNotNull is appropriate. Thanks! Note that when we line wrap we wrap 4 spaces, not 2. I've discovered that our checkstyle is not working for this case, apparently because it is too old. There are multiple style violations that the newer version detects, so there will be some cleanup anyway later. |
in class AuthorityOverridingTransportFactory, we do nothing just to override the authority, and if authorityOverride is null, in fact we really do nothing in AuthorityOverridingTransportFactory.
So I suggest that we should add a null check before we new AuthorityOverridingTransportFactory instance. If authorityOverride is null, we don't need to create it, we can just use the original one returned by buildTransportFactory().