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 logic to replace the standard RxJava 2 schedulers with reactor ones #202

Merged
merged 3 commits into from
Apr 12, 2019

Conversation

akarnokd
Copy link
Contributor

This PR allows the user to replace the standard RxJava 2 schedulers with its Reactor-Core counterparts (and restore the defaults as well) so that redundant worker threads could be avoided.

@bsideup
Copy link
Contributor

bsideup commented Apr 11, 2019

Hi @akarnokd,

Nice to see this topic being discussed :)

Have you seen reactor/reactor-core#1655 by any chance?
Would love to hear your opinion on it!

@akarnokd
Copy link
Contributor Author

I don't know what that issue is about.

…hedulers.java

Co-Authored-By: akarnokd <akarnokd@gmail.com>
@bsideup
Copy link
Contributor

bsideup commented Apr 11, 2019

We identified a problem when users shade Reactor (aka relocate it with different package name) that the schedulers are obviously not shared anymore. It correlates with your motivation ( "so that redundant worker threads could be avoided" ) in this PR, but from a different perspective, this is why I thought you may be interested in joining the conversation there.
One way of solving it was a suggestion to use the common ForkJoinPool provided by the JDK.
There is also an open question whether we should use it by default in Schedulers.parallel.

…hedulersTest.java

Co-Authored-By: akarnokd <akarnokd@gmail.com>
@simonbasle simonbasle added this to the 3.3.0.RELEASE milestone Apr 12, 2019
@simonbasle simonbasle merged commit 98f3a52 into reactor:master Apr 12, 2019
@simonbasle
Copy link
Member

Thanks for the PR @akarnokd 🙇

Regarding the core issue quoted by @bsideup, have you got any insight on shading? Has it come up in RxJava 2 world that some library would shade RxJava (with package relocation) and then duplicate worker threads issue would arise for downstream users that use both said library and vanilla RxJava?

@simonbasle simonbasle added the type/enhancement A general enhancement label Apr 12, 2019
@akarnokd akarnokd deleted the ReplaceStdRxSchedulers branch April 12, 2019 14:49
@akarnokd
Copy link
Contributor Author

You'd have to know where RxJavaPlugins ended up and do the same hooking as with this PR.

@simonbasle simonbasle modified the milestones: 3.3.0.RELEASE, 3.3.0.M1 May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants