@@ -6291,7 +6291,8 @@ public final Observable<T> mergeWith(Observable<? extends T> t1) {
62916291
62926292 /**
62936293 * 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+ *
62956296 * <p>Note that onError notifications will cut ahead of onNext notifications on the emission thread if Scheduler is truly
62966297 * asynchronous. If strict event ordering is required, consider using the {@link #observeOn(Scheduler, boolean)} overload.
62976298 * <p>
@@ -6308,13 +6309,41 @@ public final Observable<T> mergeWith(Observable<? extends T> t1) {
63086309 * @see <a href="http://reactivex.io/documentation/operators/observeon.html">ReactiveX operators documentation: ObserveOn</a>
63096310 * @see <a href="http://www.grahamlea.com/2014/07/rxjava-threading-examples/">RxJava Threading Examples</a>
63106311 * @see #subscribeOn
6312+ * @see #observeOn(Scheduler, int)
63116313 * @see #observeOn(Scheduler, boolean)
6314+ * @see #observeOn(Scheduler, boolean, int)
63126315 */
63136316 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);
63186347 }
63196348
63206349 /**
@@ -6339,12 +6368,45 @@ public final Observable<T> observeOn(Scheduler scheduler) {
63396368 * @see <a href="http://www.grahamlea.com/2014/07/rxjava-threading-examples/">RxJava Threading Examples</a>
63406369 * @see #subscribeOn
63416370 * @see #observeOn(Scheduler)
6371+ * @see #observeOn(Scheduler, int)
6372+ * @see #observeOn(Scheduler, boolean, int)
63426373 */
63436374 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) {
63446406 if (this instanceof ScalarSynchronousObservable) {
63456407 return ((ScalarSynchronousObservable<T>)this).scalarScheduleOn(scheduler);
63466408 }
6347- return lift(new OperatorObserveOn<T>(scheduler, delayError));
6409+ return lift(new OperatorObserveOn<T>(scheduler, delayError, bufferSize ));
63486410 }
63496411
63506412 /**
0 commit comments