49
49
import rx .operators .OperationDematerialize ;
50
50
import rx .operators .OperationDistinct ;
51
51
import rx .operators .OperationDistinctUntilChanged ;
52
- import rx .operators .OperatorDoOnEach ;
53
52
import rx .operators .OperationElementAt ;
54
53
import rx .operators .OperationFilter ;
55
54
import rx .operators .OperationFinally ;
63
62
import rx .operators .OperationMergeDelayError ;
64
63
import rx .operators .OperationMinMax ;
65
64
import rx .operators .OperationMulticast ;
66
- import rx .operators .OperationObserveOn ;
67
65
import rx .operators .OperationOnErrorResumeNextViaFunction ;
68
66
import rx .operators .OperationOnErrorResumeNextViaObservable ;
69
67
import rx .operators .OperationOnErrorReturn ;
70
68
import rx .operators .OperationOnExceptionResumeNextViaObservable ;
71
69
import rx .operators .OperationParallelMerge ;
72
- import rx .operators .OperatorRepeat ;
73
70
import rx .operators .OperationReplay ;
74
71
import rx .operators .OperationRetry ;
75
72
import rx .operators .OperationSample ;
96
93
import rx .operators .OperationToObservableFuture ;
97
94
import rx .operators .OperationUsing ;
98
95
import rx .operators .OperationWindow ;
99
- import rx .operators .OperatorSubscribeOn ;
100
- import rx .operators .OperatorZip ;
101
96
import rx .operators .OperatorCast ;
97
+ import rx .operators .OperatorDoOnEach ;
102
98
import rx .operators .OperatorFromIterable ;
103
99
import rx .operators .OperatorGroupBy ;
104
100
import rx .operators .OperatorMap ;
105
101
import rx .operators .OperatorMerge ;
102
+ import rx .operators .OperatorObserveOn ;
106
103
import rx .operators .OperatorParallel ;
104
+ import rx .operators .OperatorRepeat ;
105
+ import rx .operators .OperatorSubscribeOn ;
107
106
import rx .operators .OperatorTake ;
108
107
import rx .operators .OperatorTimestamp ;
109
108
import rx .operators .OperatorToObservableList ;
110
109
import rx .operators .OperatorToObservableSortedList ;
110
+ import rx .operators .OperatorZip ;
111
111
import rx .operators .OperatorZipIterable ;
112
112
import rx .plugins .RxJavaObservableExecutionHook ;
113
113
import rx .plugins .RxJavaPlugins ;
@@ -5139,8 +5139,7 @@ public final <R> ConnectableObservable<R> multicast(Subject<? super T, ? extends
5139
5139
}
5140
5140
5141
5141
/**
5142
- * Modify the source Observable so that it asynchronously notifies {@link Observer}s on the
5143
- * specified {@link Scheduler}.
5142
+ * Move notifications to the specified {@link Scheduler} one `onNext` at a time.
5144
5143
* <p>
5145
5144
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/observeOn.png">
5146
5145
*
@@ -5151,9 +5150,26 @@ public final <R> ConnectableObservable<R> multicast(Subject<? super T, ? extends
5151
5150
* @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#wiki-observeon">RxJava Wiki: observeOn()</a>
5152
5151
*/
5153
5152
public final Observable <T > observeOn (Scheduler scheduler ) {
5154
- return create ( OperationObserveOn . observeOn ( this , scheduler ));
5153
+ return lift ( new OperatorObserveOn < T >( scheduler ));
5155
5154
}
5156
5155
5156
+ /**
5157
+ * Move notifications to the specified {@link Scheduler} asynchronously with a buffer of the given size.
5158
+ * <p>
5159
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/observeOn.png">
5160
+ *
5161
+ * @param scheduler
5162
+ * the {@link Scheduler} to notify {@link Observer}s on
5163
+ * @param bufferSize
5164
+ * that will be rounded up to the next power of 2
5165
+ * @return the source Observable modified so that its {@link Observer}s are notified on the
5166
+ * specified {@link Scheduler}
5167
+ * @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#wiki-observeon">RxJava Wiki: observeOn()</a>
5168
+ */
5169
+ public final Observable <T > observeOn (Scheduler scheduler , int bufferSize ) {
5170
+ return lift (new OperatorObserveOn <T >(scheduler , bufferSize ));
5171
+ }
5172
+
5157
5173
/**
5158
5174
* Filters the items emitted by an Observable, only emitting those of the specified type.
5159
5175
* <p>
@@ -5296,7 +5312,9 @@ public final Observable<T> onExceptionResumeNext(final Observable<? extends T> r
5296
5312
* @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#wiki-parallel">RxJava Wiki: parallel()</a>
5297
5313
*/
5298
5314
public final <R > Observable <R > parallel (Func1 <Observable <T >, Observable <R >> f ) {
5299
- return lift (new OperatorParallel <T , R >(f , Schedulers .computation ()));
5315
+ // TODO move this back to Schedulers.computation() again once that is properly using eventloops
5316
+ // see https://github.com/Netflix/RxJava/issues/713 for why this was changed
5317
+ return lift (new OperatorParallel <T , R >(f , Schedulers .newThread ()));
5300
5318
}
5301
5319
5302
5320
/**
0 commit comments