@@ -6291,7 +6291,8 @@ public final Observable<T> mergeWith(Observable<? extends T> t1) {
6291
6291
6292
6292
/**
6293
6293
* Modifies an Observable to perform its emissions and notifications on a specified {@link Scheduler},
6294
- * asynchronously with a bounded buffer.
6294
+ * asynchronously with a bounded buffer of {@link RxRingBuffer.SIZE} slots.
6295
+ *
6295
6296
* <p>Note that onError notifications will cut ahead of onNext notifications on the emission thread if Scheduler is truly
6296
6297
* asynchronous. If strict event ordering is required, consider using the {@link #observeOn(Scheduler, boolean)} overload.
6297
6298
* <p>
@@ -6308,13 +6309,41 @@ public final Observable<T> mergeWith(Observable<? extends T> t1) {
6308
6309
* @see <a href="http://reactivex.io/documentation/operators/observeon.html">ReactiveX operators documentation: ObserveOn</a>
6309
6310
* @see <a href="http://www.grahamlea.com/2014/07/rxjava-threading-examples/">RxJava Threading Examples</a>
6310
6311
* @see #subscribeOn
6312
+ * @see #observeOn(Scheduler, int)
6311
6313
* @see #observeOn(Scheduler, boolean)
6314
+ * @see #observeOn(Scheduler, boolean, int)
6312
6315
*/
6313
6316
public final Observable<T> observeOn(Scheduler scheduler) {
6314
- if (this instanceof ScalarSynchronousObservable) {
6315
- return ((ScalarSynchronousObservable<T>)this).scalarScheduleOn(scheduler);
6316
- }
6317
- return lift(new OperatorObserveOn<T>(scheduler, false));
6317
+ return observeOn(scheduler, RxRingBuffer.SIZE);
6318
+ }
6319
+
6320
+ /**
6321
+ * Modifies an Observable to perform its emissions and notifications on a specified {@link Scheduler},
6322
+ * asynchronously with a bounded buffer of configurable size other than the {@link RxRingBuffer.SIZE}
6323
+ * default.
6324
+ *
6325
+ * <p>Note that onError notifications will cut ahead of onNext notifications on the emission thread if Scheduler is truly
6326
+ * asynchronous. If strict event ordering is required, consider using the {@link #observeOn(Scheduler, boolean)} overload.
6327
+ * <p>
6328
+ * <img width="640" height="308" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/observeOn.png" alt="">
6329
+ * <dl>
6330
+ * <dt><b>Scheduler:</b></dt>
6331
+ * <dd>you specify which {@link Scheduler} this operator will use</dd>
6332
+ * </dl>
6333
+ *
6334
+ * @param scheduler the {@link Scheduler} to notify {@link Observer}s on
6335
+ * @param bufferSize the size of the buffer.
6336
+ * @return the source Observable modified so that its {@link Observer}s are notified on the specified
6337
+ * {@link Scheduler}
6338
+ * @see <a href="http://reactivex.io/documentation/operators/observeon.html">ReactiveX operators documentation: ObserveOn</a>
6339
+ * @see <a href="http://www.grahamlea.com/2014/07/rxjava-threading-examples/">RxJava Threading Examples</a>
6340
+ * @see #subscribeOn
6341
+ * @see #observeOn(Scheduler)
6342
+ * @see #observeOn(Scheduler, boolean)
6343
+ * @see #observeOn(Scheduler, boolean, int)
6344
+ */
6345
+ public final Observable<T> observeOn(Scheduler scheduler, int bufferSize) {
6346
+ return observeOn(scheduler, false, bufferSize);
6318
6347
}
6319
6348
6320
6349
/**
@@ -6339,12 +6368,45 @@ public final Observable<T> observeOn(Scheduler scheduler) {
6339
6368
* @see <a href="http://www.grahamlea.com/2014/07/rxjava-threading-examples/">RxJava Threading Examples</a>
6340
6369
* @see #subscribeOn
6341
6370
* @see #observeOn(Scheduler)
6371
+ * @see #observeOn(Scheduler, int)
6372
+ * @see #observeOn(Scheduler, boolean, int)
6342
6373
*/
6343
6374
public final Observable<T> observeOn(Scheduler scheduler, boolean delayError) {
6375
+ return observeOn(scheduler, delayError, RxRingBuffer.SIZE);
6376
+ }
6377
+
6378
+ /**
6379
+ * Modifies an Observable to perform its emissions and notifications on a specified {@link Scheduler},
6380
+ * asynchronously with a bounded buffer of configurable size other than the {@link RxRingBuffer.SIZE}
6381
+ * default, and optionally delays onError notifications.
6382
+ * <p>
6383
+ * <img width="640" height="308" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/observeOn.png" alt="">
6384
+ * <dl>
6385
+ * <dt><b>Scheduler:</b></dt>
6386
+ * <dd>you specify which {@link Scheduler} this operator will use</dd>
6387
+ * </dl>
6388
+ *
6389
+ * @param scheduler
6390
+ * the {@link Scheduler} to notify {@link Observer}s on
6391
+ * @param delayError
6392
+ * indicates if the onError notification may not cut ahead of onNext notification on the other side of the
6393
+ * scheduling boundary. If true a sequence ending in onError will be replayed in the same order as was received
6394
+ * from upstream
6395
+ * @param bufferSize the size of the buffer.
6396
+ * @return the source Observable modified so that its {@link Observer}s are notified on the specified
6397
+ * {@link Scheduler}
6398
+ * @see <a href="http://reactivex.io/documentation/operators/observeon.html">ReactiveX operators documentation: ObserveOn</a>
6399
+ * @see <a href="http://www.grahamlea.com/2014/07/rxjava-threading-examples/">RxJava Threading Examples</a>
6400
+ * @see #subscribeOn
6401
+ * @see #observeOn(Scheduler)
6402
+ * @see #observeOn(Scheduler, int)
6403
+ * @see #observeOn(Scheduler, boolean)
6404
+ */
6405
+ public final Observable<T> observeOn(Scheduler scheduler, boolean delayError, int bufferSize) {
6344
6406
if (this instanceof ScalarSynchronousObservable) {
6345
6407
return ((ScalarSynchronousObservable<T>)this).scalarScheduleOn(scheduler);
6346
6408
}
6347
- return lift(new OperatorObserveOn<T>(scheduler, delayError));
6409
+ return lift(new OperatorObserveOn<T>(scheduler, delayError, bufferSize ));
6348
6410
}
6349
6411
6350
6412
/**
0 commit comments