diff --git a/src/main/java/rx/internal/util/ScalarSynchronousObservable.java b/src/main/java/rx/internal/util/ScalarSynchronousObservable.java index f4c8c3cd2e..ecb5c18d98 100644 --- a/src/main/java/rx/internal/util/ScalarSynchronousObservable.java +++ b/src/main/java/rx/internal/util/ScalarSynchronousObservable.java @@ -23,7 +23,6 @@ import rx.internal.producers.SingleProducer; import rx.internal.schedulers.EventLoopsScheduler; import rx.observers.Subscribers; -import rx.schedulers.Schedulers; /** * An Observable that emits a single constant scalar value to Subscribers. @@ -34,19 +33,6 @@ * @param the value type */ public final class ScalarSynchronousObservable extends Observable { - - /** - * We expect the Schedulers.computation() to return an EventLoopsScheduler all the time. - */ - static final Func1 COMPUTATION_ONSCHEDULE = new Func1() { - final EventLoopsScheduler els = (EventLoopsScheduler)Schedulers.computation(); - - @Override - public Subscription call(Action0 t) { - return els.scheduleDirect(t); - } - }; - /** * Indicates that the Producer used by this Observable should be fully * threadsafe. It is possible, but unlikely that multiple concurrent @@ -115,7 +101,13 @@ public T get() { public Observable scalarScheduleOn(final Scheduler scheduler) { final Func1 onSchedule; if (scheduler instanceof EventLoopsScheduler) { - onSchedule = COMPUTATION_ONSCHEDULE; + final EventLoopsScheduler els = (EventLoopsScheduler) scheduler; + onSchedule = new Func1() { + @Override + public Subscription call(Action0 a) { + return els.scheduleDirect(a); + } + }; } else { onSchedule = new Func1() { @Override