From 3759b0eda798d1d1c7a577ec3bc74582f2194c4a Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Sat, 19 Apr 2014 21:00:28 -0700 Subject: [PATCH 1/2] ComputationScheduler -> EventLoopsScheduler - This implementation is used by Schedulers.computation() but is actually a pool of event loops, so renaming. --- .../{ComputationScheduler.java => EventLoopsScheduler.java} | 2 +- rxjava-core/src/main/java/rx/schedulers/Schedulers.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename rxjava-core/src/main/java/rx/schedulers/{ComputationScheduler.java => EventLoopsScheduler.java} (98%) diff --git a/rxjava-core/src/main/java/rx/schedulers/ComputationScheduler.java b/rxjava-core/src/main/java/rx/schedulers/EventLoopsScheduler.java similarity index 98% rename from rxjava-core/src/main/java/rx/schedulers/ComputationScheduler.java rename to rxjava-core/src/main/java/rx/schedulers/EventLoopsScheduler.java index 27214c6e0f..a5e3899368 100644 --- a/rxjava-core/src/main/java/rx/schedulers/ComputationScheduler.java +++ b/rxjava-core/src/main/java/rx/schedulers/EventLoopsScheduler.java @@ -11,7 +11,7 @@ import rx.subscriptions.CompositeSubscription; import rx.subscriptions.Subscriptions; -/* package */class ComputationScheduler extends Scheduler { +/* package */class EventLoopsScheduler extends Scheduler { private static class ComputationSchedulerPool { final int cores = Runtime.getRuntime().availableProcessors(); diff --git a/rxjava-core/src/main/java/rx/schedulers/Schedulers.java b/rxjava-core/src/main/java/rx/schedulers/Schedulers.java index 74f033c1cf..2f6a886c61 100644 --- a/rxjava-core/src/main/java/rx/schedulers/Schedulers.java +++ b/rxjava-core/src/main/java/rx/schedulers/Schedulers.java @@ -36,7 +36,7 @@ private Schedulers() { if (c != null) { computationScheduler = c; } else { - computationScheduler = new ComputationScheduler(); + computationScheduler = new EventLoopsScheduler(); } Scheduler io = RxJavaPlugins.getInstance().getDefaultSchedulers().getIOScheduler(); From 9826fc9e5124b81b99e45f30726196023afce0e5 Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Sat, 19 Apr 2014 21:07:03 -0700 Subject: [PATCH 2/2] Restoring parallel() to using Schedulers.computation() See https://github.com/Netflix/RxJava/issues/713 for background on this. --- rxjava-core/src/main/java/rx/Observable.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rxjava-core/src/main/java/rx/Observable.java b/rxjava-core/src/main/java/rx/Observable.java index 01d6e070e8..fa31251247 100644 --- a/rxjava-core/src/main/java/rx/Observable.java +++ b/rxjava-core/src/main/java/rx/Observable.java @@ -5079,9 +5079,7 @@ public final Observable onExceptionResumeNext(final Observable r * @see RxJava Wiki: parallel() */ public final Observable parallel(Func1, Observable> f) { - // TODO move this back to Schedulers.computation() again once that is properly using eventloops - // see https://github.com/Netflix/RxJava/issues/713 for why this was changed - return lift(new OperatorParallel(f, Schedulers.newThread())); + return lift(new OperatorParallel(f, Schedulers.computation())); } /**