|
23 | 23 | import io.reactivex.flowables.*;
|
24 | 24 | import io.reactivex.functions.*;
|
25 | 25 | import io.reactivex.internal.functions.*;
|
26 |
| -import io.reactivex.internal.fuseable.ScalarCallable; |
| 26 | +import io.reactivex.internal.fuseable.*; |
27 | 27 | import io.reactivex.internal.operators.flowable.*;
|
| 28 | +import io.reactivex.internal.operators.flowable.FlowableStrict.StrictSubscriber; |
28 | 29 | import io.reactivex.internal.operators.observable.ObservableFromPublisher;
|
29 | 30 | import io.reactivex.internal.schedulers.ImmediateThinScheduler;
|
30 | 31 | import io.reactivex.internal.subscribers.*;
|
@@ -1557,7 +1558,7 @@ public static <T> Flowable<T> concatEager(Publisher<? extends Publisher<? extend
|
1557 | 1558 | @SchedulerSupport(SchedulerSupport.NONE)
|
1558 | 1559 | @SuppressWarnings({ "rawtypes", "unchecked" })
|
1559 | 1560 | public static <T> Flowable<T> concatEager(Publisher<? extends Publisher<? extends T>> sources, int maxConcurrency, int prefetch) {
|
1560 |
| - return RxJavaPlugins.onAssembly(new FlowableConcatMapEager(sources, Functions.identity(), maxConcurrency, prefetch, ErrorMode.IMMEDIATE)); |
| 1561 | + return RxJavaPlugins.onAssembly(new FlowableConcatMapEagerPublisher(sources, Functions.identity(), maxConcurrency, prefetch, ErrorMode.IMMEDIATE)); |
1561 | 1562 | }
|
1562 | 1563 |
|
1563 | 1564 | /**
|
@@ -11679,7 +11680,7 @@ public final Flowable<T> retryWhen(
|
11679 | 11680 | public final void safeSubscribe(Subscriber<? super T> s) {
|
11680 | 11681 | ObjectHelper.requireNonNull(s, "s is null");
|
11681 | 11682 | if (s instanceof SafeSubscriber) {
|
11682 |
| - subscribe(s); |
| 11683 | + subscribe((SafeSubscriber<? super T>)s); |
11683 | 11684 | } else {
|
11684 | 11685 | subscribe(new SafeSubscriber<T>(s));
|
11685 | 11686 | }
|
@@ -12713,13 +12714,15 @@ public final Flowable<T> startWithArray(T... items) {
|
12713 | 12714 | * </dl>
|
12714 | 12715 | * @return the new Flowable instance
|
12715 | 12716 | * @since 2.0.5 - experimental
|
| 12717 | + * @deprecated 2.0.7, will be removed in 2.1.0; by default, the Publisher interface is always strict |
12716 | 12718 | */
|
12717 | 12719 | @BackpressureSupport(BackpressureKind.PASS_THROUGH)
|
12718 | 12720 | @SchedulerSupport(SchedulerSupport.NONE)
|
12719 | 12721 | @Experimental
|
12720 | 12722 | @CheckReturnValue
|
| 12723 | + @Deprecated |
12721 | 12724 | public final Flowable<T> strict() {
|
12722 |
| - return RxJavaPlugins.onAssembly(new FlowableStrict<T>(this)); |
| 12725 | + return this; |
12723 | 12726 | }
|
12724 | 12727 |
|
12725 | 12728 | /**
|
@@ -12892,13 +12895,61 @@ public final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super T
|
12892 | 12895 | @SchedulerSupport(SchedulerSupport.NONE)
|
12893 | 12896 | @Override
|
12894 | 12897 | public final void subscribe(Subscriber<? super T> s) {
|
| 12898 | + if (s instanceof FlowableSubscriber) { |
| 12899 | + subscribe((FlowableSubscriber<? super T>)s); |
| 12900 | + } else { |
| 12901 | + ObjectHelper.requireNonNull(s, "s is null"); |
| 12902 | + subscribe(new StrictSubscriber<T>(s)); |
| 12903 | + } |
| 12904 | + } |
| 12905 | + |
| 12906 | + /** |
| 12907 | + * Establish a connection between this Flowable and the given FlowableSubscriber and |
| 12908 | + * start streaming events based on the demand of the FlowableSubscriber. |
| 12909 | + * <p> |
| 12910 | + * This is a "factory method" and can be called multiple times, each time starting a new {@link Subscription}. |
| 12911 | + * <p> |
| 12912 | + * Each {@link Subscription} will work for only a single {@link FlowableSubscriber}. |
| 12913 | + * <p> |
| 12914 | + * If the same {@link FlowableSubscriber} instance is subscribed to multiple {@link Flowable}s and/or the |
| 12915 | + * same {@link Flowable} multiple times, it must ensure the serialization over its {@code onXXX} |
| 12916 | + * methods manually. |
| 12917 | + * <p> |
| 12918 | + * If the {@link Flowable} rejects the subscription attempt or otherwise fails it will signal |
| 12919 | + * the error via {@link FlowableSubscriber#onError(Throwable)}. |
| 12920 | + * <p> |
| 12921 | + * This subscribe method relaxes the following Reactive-Streams rules: |
| 12922 | + * <ul> |
| 12923 | + * <li>§1.3: onNext should not be called concurrently until onSubscribe returns. |
| 12924 | + * <b>FlowableSubscriber.onSubscribe should make sure a sync or async call triggered by request() is safe.</b></li> |
| 12925 | + * <li>§2.3: onError or onComplete must not call cancel. |
| 12926 | + * <b>Calling request() or cancel() is NOP at this point.</b></li> |
| 12927 | + * <li>§2.12: onSubscribe must be called at most once on the same instance. |
| 12928 | + * <b>FlowableSubscriber reuse is not checked and if happens, it is the responsibility of |
| 12929 | + * the FlowableSubscriber to ensure proper serialization of its onXXX methods.</b></li> |
| 12930 | + * <li>§3.9: negative requests should emit an onError(IllegalArgumentException). |
| 12931 | + * <b>Non-positive requests signal via RxJavaPlugins.onError and the stream is not affected.</b></li> |
| 12932 | + * </ul> |
| 12933 | + * <dl> |
| 12934 | + * <dt><b>Backpressure:</b></dt> |
| 12935 | + * <dd>The backpressure behavior/expectation is determined by the supplied {@code FlowableSubscriber}.</dd> |
| 12936 | + * <dt><b>Scheduler:</b></dt> |
| 12937 | + * <dd>{@code subscribe} does not operate by default on a particular {@link Scheduler}.</dd> |
| 12938 | + * </dl> |
| 12939 | + * @param s the FlowableSubscriber that will consume signals from this Flowable |
| 12940 | + * @since 2.0.7 - experimental |
| 12941 | + */ |
| 12942 | + @BackpressureSupport(BackpressureKind.SPECIAL) |
| 12943 | + @SchedulerSupport(SchedulerSupport.NONE) |
| 12944 | + @Experimental |
| 12945 | + public final void subscribe(FlowableSubscriber<? super T> s) { |
12895 | 12946 | ObjectHelper.requireNonNull(s, "s is null");
|
12896 | 12947 | try {
|
12897 |
| - s = RxJavaPlugins.onSubscribe(this, s); |
| 12948 | + Subscriber<? super T> z = RxJavaPlugins.onSubscribe(this, s); |
12898 | 12949 |
|
12899 |
| - ObjectHelper.requireNonNull(s, "Plugin returned null Subscriber"); |
| 12950 | + ObjectHelper.requireNonNull(z, "Plugin returned null Subscriber"); |
12900 | 12951 |
|
12901 |
| - subscribeActual(s); |
| 12952 | + subscribeActual(z); |
12902 | 12953 | } catch (NullPointerException e) { // NOPMD
|
12903 | 12954 | throw e;
|
12904 | 12955 | } catch (Throwable e) {
|
|
0 commit comments