-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
2.x: Should schedulers have RxThreadFactory constructor parameters? #4993
Comments
Which scheduler? Computation? It was intentional. You can now configure the priority of each scheduler so there was little benefit from a customizing the factory. Use the ParallelScheduler from extensions which allows more customization. |
We used it for the IO scheduler as well. It was useful for tracking our own thread naming and setting their priority to android-specific priorities. We'd like to use it for that and SingleScheduler. Can ParallelScheduler be used as a substitute for non-computation schedulers too? |
Since scheduler implementations are internal, it is not recommended anyway to use them directly. ParallelScheduler is an individual scheduler with a specified number of threads that doesn't change over time. So unlike io(), ParallelScheduler won't stop its threads when they become idle for too long. |
I'm not sure I follow. As in we shouldn't create a new IoScheduler instance? |
Anything in the |
So either use |
I missed that they were internal now. That's disappointing to see, and seems like a bit of a step backward compared to RxJava 1. We'll just copy then :| |
They're internal in 1.x too. The only remnants are public for binary
compatibility that no one should be using anyway. Are you referring to the
factory methods? Those could easily be replicated on 2.x.
…On Fri, Jan 13, 2017, 4:22 AM Zac Sweers ***@***.***> wrote:
I missed that they were internal now. That's disappointing to see, and
seems like a bit of a step backward compared to RxJava 1. We'll just copy
then :|
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4993 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEEERdKOOoaZajpQio5Pgsyac0sCa0Lks5rR2x0gaJpZM4LiyuF>
.
|
Yeah I was referring to the factory methods. Basically wanted to do the same thing you added in the linked PR above |
@akarnokd any thoughts on this? This is what I was thinking of in opening this issue, in case I wasn't clear before |
They will be still internal classes. However, we could expose them, for example, |
That sounds reasonable to me. The APIs they expose cover pretty much everything we'd want, would be happy to make a PR matching those if you're up for it. |
Sure. |
Resolves ReactiveX#4993 This is a pretty vanilla copy from RxJava 1's implementation. Note that I had to tune NewThread scheduler to not be a singleton to support this. We had talked about borrowing from project reactor's APIs for different overloads, let me know if you think we should add more fine-grained controls through these.
* Add scheduler creation factories Resolves #4993 This is a pretty vanilla copy from RxJava 1's implementation. Note that I had to tune NewThread scheduler to not be a singleton to support this. We had talked about borrowing from project reactor's APIs for different overloads, let me know if you think we should add more fine-grained controls through these. * Add `@since` info * Change failure string to "is null" * Move to RxJavaPlugins * Remove no-arg overloads * Rename to make it clearer about creation Added scheduler because we're not in Scheduler anymore. Changed to "create" because "newNewThread" was weird * Add tests (WIP) * Remove unnecessary nullcheck * Remove double try * Fix tests, make them more robust with integration flow * Shut down custom schedulers when done
RxJava 1 allowed for specifying a custom thread factory, but it looks like this feature did not make it to RxJava 2. Was this intentional or something that a PR would be welcome for?
The text was updated successfully, but these errors were encountered: