Porting the Scheduler.when operator from 1.x to 2.x#4827
Merged
akarnokd merged 1 commit intoReactiveX:2.xfrom Nov 10, 2016
Merged
Porting the Scheduler.when operator from 1.x to 2.x#4827akarnokd merged 1 commit intoReactiveX:2.xfrom
akarnokd merged 1 commit intoReactiveX:2.xfrom
Conversation
akarnokd
approved these changes
Nov 9, 2016
| final Worker actualWorker = actualScheduler.createWorker(); | ||
| // a queue for the actions submitted while worker is waiting to get to | ||
| // the subscribe to off the workerQueue. | ||
| ReplaySubject<ScheduledAction> actionSubject = ReplaySubject.create(); |
Member
There was a problem hiding this comment.
You can use a ReplayProcessor instead.
| Flowable<Completable> actions = actionSubject.toFlowable(BackpressureStrategy.BUFFER).map(new Function<ScheduledAction, Completable>() { | ||
| @Override | ||
| public Completable apply(final ScheduledAction action) { | ||
| return Completable.unsafeCreate(new CompletableSource() { |
Member
There was a problem hiding this comment.
No need for such indirection, just extend Completable:
return new Completable() {
@Override
public void subscribeActual(CompletableObserver actionCompletable) {
actionCompletable.onSubscribe(action);
action.call(actualWorker, actionCompletable);
}
};
akarnokd
reviewed
Nov 9, 2016
| import java.util.concurrent.atomic.AtomicBoolean; | ||
| import java.util.concurrent.atomic.AtomicReference; | ||
|
|
||
| import org.openjdk.jmh.runner.RunnerException; |
Member
There was a problem hiding this comment.
This is not available in the main build.
https://travis-ci.org/ReactiveX/RxJava/builds/174626634#L169
ed1dcb3 to
ad5ab3a
Compare
Current coverage is 95.66% (diff: 76.31%)@@ 2.x #4827 diff @@
==========================================
Files 570 571 +1
Lines 36723 36799 +76
Methods 0 0
Messages 0 0
Branches 5556 5563 +7
==========================================
+ Hits 35143 35202 +59
- Misses 651 663 +12
- Partials 929 934 +5
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In fixing the Scheduler.when in 1.x I noticed that it hadn't been ported to 2.x. This PR tries to fix that translating Observable to Flowable and Subscription to Disposable. This also includes the fix from 1.x