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

okhttp: Improve internals for executor handling #9073

Merged
merged 2 commits into from
Apr 15, 2022

Conversation

ejona86
Copy link
Member

@ejona86 ejona86 commented Apr 8, 2022

I'll leave the two commits separate when merging. Each commit has a description discussing what is going on a bit more.

This matches what we do in ManagedChannelImplBuilder and
NettyChannelBuilder. It also fixes a (probably unimportant) bug where
the factory returned from swapChannelCredentials() didn't have its
references to the executors so could not outlive the parent factory.
Users should be able to inject all executors. The transport shouldn't be
hard-coded to create the TIMER_SERVICE, especially since a scheduler is
already available to the builder.
@ejona86 ejona86 requested a review from temawi April 8, 2022 19:17
this.scheduledExecutorService =
checkNotNull(scheduledExecutorService, "scheduledExecutorService");
this.scheduledExecutorServicePool =
new FixedObjectPool<>(checkNotNull(scheduledExecutorService, "scheduledExecutorService"));
Copy link
Contributor

Choose a reason for hiding this comment

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

I take it that "It's an optional parameter" in the JavaDoc is referring to scheduledExecutorService. It's not optional so the JavaDoc should change?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is meaning, "you don't have to call this method on the builder."

There is oddity here. Compare how scheduledExecutorService() handles null vs transportExecutor(). But that was existing, so I didn't touch it.

@ejona86 ejona86 merged commit 592a227 into grpc:master Apr 15, 2022
@ejona86 ejona86 deleted the okhttp-executors branch April 15, 2022 22:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2022
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.

2 participants