-
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
Remove Parallel Operator #1673
Comments
I'm in favor of removing it, as you say it's mostly used incorrectly and someone who wants to control parallelism can always use the ExecutorScheduler. |
Thanks for raising this one, it's been on my list to mention. A while back I used the parallel method for an HPC task and found it confusing. I expected to find Scala collections Could we simplify
and an overload to specify the scheduler:
|
@davidmoten Those signatures don't take a function with the work to do while in parallel so aren't correct. I suggest we remove them and allow a new RxJavaParallel project to explore alternatives and only once it is proven and matured to merge it into RxJava itself. This would include something like a |
Oh yeah woops, the merge means the parallel is lost. So I wonder what the rx-java analogy to the Scala collections par method is? |
I suppose it's likely to be
I wonder if that's of use? |
I just had a look at Scala's
where Blimey I've got reading problems, Ben suggested exactly this. Ta Ben. |
Work on |
This has been completed and will be released in 0.20.5 and 1.0 RC4. Anyone looking for a replacement to the simple "run things in parallel" use case, you likely want this: streamOfItems.flatMap(item -> {
doStuffWithItem(item).subscribeOn(Schedulers.io());
}); The |
Hi, @benjchristensen , @davidmoten , @jbripley , I agree with using flatMap(). I have 1 question, flatMap will do the operation and merge it back to main thread and onNext() will be called. What if one Observable ends with Observable.error() in that case Observable.error() will be called in main thread? If yes, then main thread will shut down and what will happen to other Observables running in parallel? If no, then result from other Observable will be triggered in onNext? Correct me If I am wrong as I have just started with RxJava. |
@rishi-anand please post your question on StackOverflow with details on what you have already implemented. |
Almost every time I see the 'parallel' operator used it is being used incorrectly and misunderstood. This leads me to believe we should remove it and instead educate on how to use merge and flatMap correctly which is generally what is trying to be achieved in uses of parallel.
Anyone have good reason not to eliminate it?
/cc @headinthebox
The text was updated successfully, but these errors were encountered: