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

3.x: Add concatMap with Scheduler guaranteeing where the mapper runs #6538

Merged
merged 1 commit into from
Jun 24, 2019

Conversation

akarnokd
Copy link
Member

This PR adds an overload to concatMap and concatMapDelayError in both Flowable and Observable which makes sure the mapper function is always executed on a dedicated scheduler.

By default concatMap may execute the mapper function on various threads: the subscribing thread, the upstream thread generating the items to be mapped or the thread where the generated inner source terminates. These overloads remove this kind of uncertainty.

The implementation is a copy of the original concatMap instead of an extension so that optimizations for the non-scheduled variants still work without extra overhead.

Overloads to the concatMap{Single|Maybe|Completable} and concatMap{Single|Maybe|Completable}DelayError may be added in a separate PR later.

Resolves #6447

@codecov
Copy link

codecov bot commented Jun 24, 2019

Codecov Report

Merging #6538 into 3.x will increase coverage by 0.07%.
The diff coverage is 98.86%.

Impacted file tree graph

@@             Coverage Diff             @@
##               3.x    #6538      +/-   ##
===========================================
+ Coverage     98.2%   98.27%   +0.07%     
- Complexity    6198     6214      +16     
===========================================
  Files          680      682       +2     
  Lines        44976    45505     +529     
  Branches      6202     6288      +86     
===========================================
+ Hits         44168    44722     +554     
+ Misses         259      248      -11     
+ Partials       549      535      -14
Impacted Files Coverage Δ Complexity Δ
src/main/java/io/reactivex/Flowable.java 100% <100%> (ø) 575 <3> (+3) ⬆️
src/main/java/io/reactivex/Observable.java 100% <100%> (ø) 550 <3> (+3) ⬆️
...ators/observable/ObservableConcatMapScheduler.java 98.82% <98.82%> (ø) 4 <4> (?)
...operators/flowable/FlowableConcatMapScheduler.java 98.83% <98.83%> (ø) 4 <4> (?)
.../io/reactivex/internal/schedulers/IoScheduler.java 89.36% <0%> (-4.26%) 9% <0%> (ø)
...nternal/operators/parallel/ParallelReduceFull.java 91.08% <0%> (-3.97%) 2% <0%> (ø)
...tivex/internal/observers/FutureSingleObserver.java 94.33% <0%> (-3.78%) 24% <0%> (-1%)
...ava/io/reactivex/processors/BehaviorProcessor.java 96.58% <0%> (-2.44%) 51% <0%> (ø)
...rnal/operators/observable/ObservableSwitchMap.java 94.68% <0%> (-1.6%) 3% <0%> (ø)
...ivex/internal/operators/maybe/MaybeMergeArray.java 96.62% <0%> (-1.13%) 6% <0%> (ø)
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94ae795...00ce78b. Read the comment docs.

@akarnokd akarnokd merged commit 9e9d31c into ReactiveX:3.x Jun 24, 2019
@akarnokd akarnokd deleted the ConcatMapScheduler3x branch June 24, 2019 13:37
kojilin pushed a commit to kojilin/RxJava that referenced this pull request Jun 25, 2019
…eactiveX#6538)

Back port `Add concatMap with Scheduler guaranteeing where the mapper runs` to 2.x branch.
see ReactiveX#6538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant