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 fair mode overload to Schedulers.from(Executor) #6744

Merged
merged 1 commit into from Dec 3, 2019

Conversation

@akarnokd
Copy link
Member

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

This comment has been minimized.

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 mentioned this pull request Dec 3, 2019
0 of 32 tasks complete
@akarnokd akarnokd merged commit 292dc62 into ReactiveX:3.x Dec 3, 2019
3 checks passed
3 checks passed
codecov/patch 96% of diff hit (target 95%)
Details
codecov/project 98.13% (target 95%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@akarnokd akarnokd deleted the akarnokd:FairExecutorScheduler branch Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.