Skip to content

Conversation

@akarnokd
Copy link
Member

By default, the Schedulers.from uses a trampoline to ensure worker tasks are executed FIFO and non-overlappingly on any potentially multi-threaded Executor. This old setup didn't allow task interruption due to this disconnect between the trampoline task and the operator task. (In contrast, the standard schedulers use single threaded executors and their Future is linked and interruptible when the operator task is cancelled).

This PR add an interruptible mode to the Schedulers.from via a paramerer in a new overload and some internal dispatching based on this mode selector. Existing Schedulers.from(Executor) users should still behave the same.

Resolves: #6368

@codecov
Copy link

codecov bot commented Jan 16, 2019

Codecov Report

Merging #6370 into 2.x will decrease coverage by 0.06%.
The diff coverage is 93.54%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6370      +/-   ##
============================================
- Coverage     98.24%   98.18%   -0.07%     
- Complexity     6282     6287       +5     
============================================
  Files           673      673              
  Lines         45023    45075      +52     
  Branches       6226     6239      +13     
============================================
+ Hits          44235    44256      +21     
- Misses          248      263      +15     
- Partials        540      556      +16
Impacted Files Coverage Δ Complexity Δ
.../main/java/io/reactivex/schedulers/Schedulers.java 100% <100%> (ø) 11 <2> (+1) ⬆️
...activex/internal/schedulers/ExecutorScheduler.java 97.98% <93.33%> (-2.02%) 10 <2> (+1)
...l/operators/observable/ObservableFlatMapMaybe.java 84.96% <0%> (-8.5%) 2% <0%> (ø)
.../operators/flowable/FlowableBlockingSubscribe.java 93.02% <0%> (-4.66%) 10% <0%> (-1%)
...ternal/operators/observable/ObservablePublish.java 94.69% <0%> (-3.54%) 11% <0%> (ø)
...ava/io/reactivex/processors/BehaviorProcessor.java 96.86% <0%> (-2.25%) 60% <0%> (ø)
...rnal/operators/flowable/FlowableFlatMapSingle.java 94.56% <0%> (-2.18%) 2% <0%> (ø)
...nternal/operators/observable/ObservableWindow.java 98% <0%> (-2%) 3% <0%> (ø)
...x/internal/operators/flowable/FlowablePublish.java 96.2% <0%> (-1.69%) 10% <0%> (ø)
...internal/operators/flowable/FlowableSwitchMap.java 95.28% <0%> (-1.42%) 3% <0%> (ø)
... and 24 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 e1b3838...7c34bac. Read the comment docs.

@akarnokd akarnokd merged commit a85ddd1 into ReactiveX:2.x Jan 17, 2019
@akarnokd akarnokd deleted the InterruptibleExecutorService branch January 17, 2019 13:41
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.

2 participants