Skip to content

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Dec 3, 2019

The default Schedulers.from implementation uses an eager approach to execute tasks on the underlying Executor which can lead to excessive thread occupation on its own, even if operators use buffering/prefetch of 1.

This PR introduces a new overload with a fairness option so that tasks are submitted to the Executor in a non-overlapping and FIFO manner one by one.

In addition, the scheduler retention tests have been cleaned up and reworked to not wait unnecessarily long for the GC to finish.

Related: #6696, #6697

@akarnokd akarnokd added this to the 3.0 milestone Dec 3, 2019
@codecov
Copy link

codecov bot commented Dec 3, 2019

Codecov Report

Merging #6744 into 3.x will increase coverage by <.01%.
The diff coverage is 96%.

Impacted file tree graph

@@ Coverage Diff @@ ## 3.x #6744 +/- ## ============================================ + Coverage 98.12% 98.13% +<.01%  Complexity 6189 6189 ============================================ Files 677 677 Lines 44663 44683 +20 Branches 6171 6176 +5 ============================================ + Hits 43825 43849 +24  - Misses 299 301 +2  + Partials 539 533 -6
Impacted Files Coverage Δ Complexity Δ
...va/io/reactivex/rxjava3/schedulers/Schedulers.java 100% <100%> (ø) 12 <3> (+1) ⬆️
...rxjava3/internal/schedulers/ExecutorScheduler.java 95.89% <95.45%> (-1.11%) 10 <2> (ø)
...perators/single/SingleFlatMapIterableFlowable.java 94.16% <0%> (-2.5%) 2% <0%> (ø)
...eactivex/rxjava3/processors/BehaviorProcessor.java 96.58% <0%> (-2.44%) 51% <0%> (ø)
...tivex/rxjava3/disposables/CompositeDisposable.java 98.14% <0%> (-1.86%) 39% <0%> (-1%)
...l/operators/observable/ObservableFlatMapMaybe.java 90.84% <0%> (-1.41%) 2% <0%> (ø)
...ternal/operators/completable/CompletableMerge.java 95.94% <0%> (-1.36%) 2% <0%> (ø)
...a3/internal/operators/flowable/FlowableCreate.java 96.76% <0%> (-1.3%) 6% <0%> (ø)
...nternal/operators/observable/ObservableCreate.java 97.43% <0%> (-0.86%) 2% <0%> (ø)
... and 13 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 445def8...91f4dd4. Read the comment docs.

@akarnokd akarnokd merged commit 292dc62 into ReactiveX:3.x Dec 3, 2019
@akarnokd akarnokd deleted the FairExecutorScheduler branch December 3, 2019 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants