diff --git a/src/main/java/io/reactivex/Flowable.java b/src/main/java/io/reactivex/Flowable.java
index 363d334921..574eb37a50 100644
--- a/src/main/java/io/reactivex/Flowable.java
+++ b/src/main/java/io/reactivex/Flowable.java
@@ -6943,79 +6943,6 @@ public final > Flowable buffer(Publisher(this, boundaryIndicator, bufferSupplier));
}
- /**
- * Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting
- * Publisher emits connected, non-overlapping buffers. It emits the current buffer and replaces it with a
- * new buffer whenever the Publisher produced by the specified {@code boundaryIndicatorSupplier} emits an item.
- *
- *
- *
- * If either the source {@code Publisher} or the boundary {@code Publisher} issues an {@code onError} notification the event is passed on
- * immediately without first emitting the buffer it is in the process of assembling.
- *
- *
Backpressure:
- *
This operator does not support backpressure as it is instead controlled by the given Publishers and
- * buffers data. It requests {@code Long.MAX_VALUE} upstream and does not obey downstream requests.
- *
Scheduler:
- *
This version of {@code buffer} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param the value type of the boundary-providing Publisher
- * @param boundaryIndicatorSupplier
- * a {@link Supplier} that produces a Publisher that governs the boundary between buffers.
- * Whenever the supplied {@code Publisher} emits an item, {@code buffer} emits the current buffer and
- * begins to fill a new one
- * @return a Flowable that emits a connected, non-overlapping buffer of items from the source Publisher
- * each time the Publisher created with the {@code closingIndicator} argument emits an item
- * @see ReactiveX operators documentation: Buffer
- */
- @CheckReturnValue
- @BackpressureSupport(BackpressureKind.ERROR)
- @SchedulerSupport(SchedulerSupport.NONE)
- public final Flowable> buffer(Supplier extends Publisher> boundaryIndicatorSupplier) {
- return buffer(boundaryIndicatorSupplier, ArrayListSupplier.asSupplier());
- }
-
- /**
- * Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting
- * Publisher emits connected, non-overlapping buffers. It emits the current buffer and replaces it with a
- * new buffer whenever the Publisher produced by the specified {@code boundaryIndicatorSupplier} emits an item.
- *
- *
- *
- * If either the source {@code Publisher} or the boundary {@code Publisher} issues an {@code onError} notification the event is passed on
- * immediately without first emitting the buffer it is in the process of assembling.
- *
- *
Backpressure:
- *
This operator does not support backpressure as it is instead controlled by the given Publishers and
- * buffers data. It requests {@code Long.MAX_VALUE} upstream and does not obey downstream requests.
- *
Scheduler:
- *
This version of {@code buffer} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param the collection subclass type to buffer into
- * @param the value type of the boundary-providing Publisher
- * @param boundaryIndicatorSupplier
- * a {@link Callable} that produces a Publisher that governs the boundary between buffers.
- * Whenever the supplied {@code Publisher} emits an item, {@code buffer} emits the current buffer and
- * begins to fill a new one
- * @param bufferSupplier
- * a factory function that returns an instance of the collection subclass to be used and returned
- * as the buffer
- * @return a Flowable that emits a connected, non-overlapping buffer of items from the source Publisher
- * each time the Publisher created with the {@code closingIndicator} argument emits an item
- * @see ReactiveX operators documentation: Buffer
- */
- @CheckReturnValue
- @BackpressureSupport(BackpressureKind.ERROR)
- @SchedulerSupport(SchedulerSupport.NONE)
- public final > Flowable buffer(Supplier extends Publisher> boundaryIndicatorSupplier,
- Supplier bufferSupplier) {
- ObjectHelper.requireNonNull(boundaryIndicatorSupplier, "boundaryIndicatorSupplier is null");
- ObjectHelper.requireNonNull(bufferSupplier, "bufferSupplier is null");
- return RxJavaPlugins.onAssembly(new FlowableBufferBoundarySupplier(this, boundaryIndicatorSupplier, bufferSupplier));
- }
-
/**
* Returns a Flowable that subscribes to this Publisher lazily, caches all of its events
* and replays them, in the same order as received, to all the downstream subscribers.
@@ -12186,7 +12113,7 @@ public final Flowable onBackpressureLatest() {
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable onErrorResumeNext(Function super Throwable, ? extends Publisher extends T>> resumeFunction) {
ObjectHelper.requireNonNull(resumeFunction, "resumeFunction is null");
- return RxJavaPlugins.onAssembly(new FlowableOnErrorNext(this, resumeFunction, false));
+ return RxJavaPlugins.onAssembly(new FlowableOnErrorNext(this, resumeFunction));
}
/**
@@ -12313,53 +12240,6 @@ public final Flowable onErrorReturnItem(final T item) {
return onErrorReturn(Functions.justFunction(item));
}
- /**
- * Instructs a Publisher to pass control to another Publisher rather than invoking
- * {@link Subscriber#onError onError} if it encounters an {@link java.lang.Exception}.
- *
- * This differs from {@link #onErrorResumeNext} in that this one does not handle {@link java.lang.Throwable}
- * or {@link java.lang.Error} but lets those continue through.
- *
- *
- *
- * By default, when a Publisher encounters an exception that prevents it from emitting the expected item
- * to its {@link Subscriber}, the Publisher invokes its Subscriber's {@code onError} method, and then quits
- * without invoking any more of its Subscriber's methods. The {@code onExceptionResumeNext} method changes
- * this behavior. If you pass another Publisher ({@code resumeSequence}) to a Publisher's
- * {@code onExceptionResumeNext} method, if the original Publisher encounters an exception, instead of
- * invoking its Subscriber's {@code onError} method, it will instead relinquish control to
- * {@code resumeSequence} which will invoke the Subscriber's {@link Subscriber#onNext onNext} method if it is
- * able to do so. In such a case, because no Publisher necessarily invokes {@code onError}, the Subscriber
- * may never know that an exception happened.
- *
- * You can use this to prevent exceptions from propagating or to supply fallback data should exceptions be
- * encountered.
- *
- *
Backpressure:
- *
The operator honors backpressure from downstream. This and the resuming {@code Publisher}s
- * are expected to honor backpressure as well.
- * If any of them violate this expectation, the operator may throw an
- * {@code IllegalStateException} when the source {@code Publisher} completes or
- * {@code MissingBackpressureException} is signaled somewhere downstream.
- *
Scheduler:
- *
{@code onExceptionResumeNext} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param next
- * the next Publisher that will take over if the source Publisher encounters
- * an exception
- * @return the original Publisher, with appropriately modified behavior
- * @see ReactiveX operators documentation: Catch
- */
- @CheckReturnValue
- @NonNull
- @BackpressureSupport(BackpressureKind.FULL)
- @SchedulerSupport(SchedulerSupport.NONE)
- public final Flowable onExceptionResumeNext(final Publisher extends T> next) {
- ObjectHelper.requireNonNull(next, "next is null");
- return RxJavaPlugins.onAssembly(new FlowableOnErrorNext(this, Functions.justFunction(next), true));
- }
-
/**
* Nulls out references to the upstream producer and downstream Subscriber if
* the sequence is terminated or downstream cancels.
@@ -18290,77 +18170,6 @@ public final Flowable> window(
return RxJavaPlugins.onAssembly(new FlowableWindowBoundarySelector(this, openingIndicator, closingIndicator, bufferSize));
}
- /**
- * Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting
- * Publisher emits connected, non-overlapping windows. It emits the current window and opens a new one
- * whenever the Publisher produced by the specified {@code closingSelector} emits an item.
- *
- *
- *
- *
Backpressure:
- *
The operator consumes the source {@code Publisher} in an unbounded manner.
- * The returned {@code Publisher} doesn't support backpressure as it uses
- * the {@code closingSelector} to control the creation of windows. The returned inner {@code Publisher}s honor
- * backpressure but have an unbounded inner buffer that may lead to {@code OutOfMemoryError}
- * if left unconsumed.
- *
Scheduler:
- *
This version of {@code window} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param the element type of the boundary Publisher
- * @param boundaryIndicatorSupplier
- * a {@link Supplier} that returns a {@code Publisher} that governs the boundary between windows.
- * When the source {@code Publisher} emits an item, {@code window} emits the current window and begins
- * a new one.
- * @return a Flowable that emits connected, non-overlapping windows of items from the source Publisher
- * whenever {@code closingSelector} emits an item
- * @see ReactiveX operators documentation: Window
- */
- @CheckReturnValue
- @BackpressureSupport(BackpressureKind.ERROR)
- @SchedulerSupport(SchedulerSupport.NONE)
- public final Flowable> window(Supplier extends Publisher> boundaryIndicatorSupplier) {
- return window(boundaryIndicatorSupplier, bufferSize());
- }
-
- /**
- * Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting
- * Publisher emits connected, non-overlapping windows. It emits the current window and opens a new one
- * whenever the Publisher produced by the specified {@code closingSelector} emits an item.
- *
- *
- *
- *
Backpressure:
- *
The operator consumes the source {@code Publisher} in an unbounded manner.
- * The returned {@code Publisher} doesn't support backpressure as it uses
- * the {@code closingSelector} to control the creation of windows. The returned inner {@code Publisher}s honor
- * backpressure but have an unbounded inner buffer that may lead to {@code OutOfMemoryError}
- * if left unconsumed.
- *
Scheduler:
- *
This version of {@code window} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param the element type of the boundary Publisher
- * @param boundaryIndicatorSupplier
- * a {@link Supplier} that returns a {@code Publisher} that governs the boundary between windows.
- * When the source {@code Publisher} emits an item, {@code window} emits the current window and begins
- * a new one.
- * @param bufferSize
- * the capacity hint for the buffer in the inner windows
- * @return a Flowable that emits connected, non-overlapping windows of items from the source Publisher
- * whenever {@code closingSelector} emits an item
- * @see ReactiveX operators documentation: Window
- */
- @CheckReturnValue
- @NonNull
- @BackpressureSupport(BackpressureKind.ERROR)
- @SchedulerSupport(SchedulerSupport.NONE)
- public final Flowable> window(Supplier extends Publisher> boundaryIndicatorSupplier, int bufferSize) {
- ObjectHelper.requireNonNull(boundaryIndicatorSupplier, "boundaryIndicatorSupplier is null");
- ObjectHelper.verifyPositive(bufferSize, "bufferSize");
- return RxJavaPlugins.onAssembly(new FlowableWindowBoundarySupplier(this, boundaryIndicatorSupplier, bufferSize));
- }
-
/**
* Merges the specified Publisher into this Publisher sequence by using the {@code resultSelector}
* function only when the source Publisher (this instance) emits an item.
diff --git a/src/main/java/io/reactivex/Observable.java b/src/main/java/io/reactivex/Observable.java
index f6de4c980f..1af2119087 100644
--- a/src/main/java/io/reactivex/Observable.java
+++ b/src/main/java/io/reactivex/Observable.java
@@ -6147,70 +6147,6 @@ public final > Observable buffer(Observabl
return RxJavaPlugins.onAssembly(new ObservableBufferExactBoundary(this, boundary, bufferSupplier));
}
- /**
- * Returns an Observable that emits buffers of items it collects from the source ObservableSource. The resulting
- * ObservableSource emits connected, non-overlapping buffers. It emits the current buffer and replaces it with a
- * new buffer whenever the ObservableSource produced by the specified {@code boundarySupplier} emits an item.
- *
- *
- *
- * If either the source {@code ObservableSource} or the boundary {@code ObservableSource} issues an {@code onError} notification the event
- * is passed on immediately without first emitting the buffer it is in the process of assembling.
- *
- *
Scheduler:
- *
This version of {@code buffer} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param the value type of the boundary-providing ObservableSource
- * @param boundarySupplier
- * a {@link Supplier} that produces an ObservableSource that governs the boundary between buffers.
- * Whenever the supplied {@code ObservableSource} emits an item, {@code buffer} emits the current buffer and
- * begins to fill a new one
- * @return an Observable that emits a connected, non-overlapping buffer of items from the source ObservableSource
- * each time the ObservableSource created with the {@code closingIndicator} argument emits an item
- * @see ReactiveX operators documentation: Buffer
- */
- @CheckReturnValue
- @SchedulerSupport(SchedulerSupport.NONE)
- public final Observable> buffer(Supplier extends ObservableSource> boundarySupplier) {
- return buffer(boundarySupplier, ArrayListSupplier.asSupplier());
- }
-
- /**
- * Returns an Observable that emits buffers of items it collects from the source ObservableSource. The resulting
- * ObservableSource emits connected, non-overlapping buffers. It emits the current buffer and replaces it with a
- * new buffer whenever the ObservableSource produced by the specified {@code boundarySupplier} emits an item.
- *
- *
- *
- * If either the source {@code ObservableSource} or the boundary {@code ObservableSource} issues an {@code onError} notification the event
- * is passed on immediately without first emitting the buffer it is in the process of assembling.
- *
- *
Scheduler:
- *
This version of {@code buffer} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param the collection subclass type to buffer into
- * @param the value type of the boundary-providing ObservableSource
- * @param boundarySupplier
- * a {@link Supplier} that produces an ObservableSource that governs the boundary between buffers.
- * Whenever the supplied {@code ObservableSource} emits an item, {@code buffer} emits the current buffer and
- * begins to fill a new one
- * @param bufferSupplier
- * a factory function that returns an instance of the collection subclass to be used and returned
- * as the buffer
- * @return an Observable that emits a connected, non-overlapping buffer of items from the source ObservableSource
- * each time the ObservableSource created with the {@code closingIndicator} argument emits an item
- * @see ReactiveX operators documentation: Buffer
- */
- @CheckReturnValue
- @SchedulerSupport(SchedulerSupport.NONE)
- public final > Observable buffer(Supplier extends ObservableSource> boundarySupplier, Supplier bufferSupplier) {
- ObjectHelper.requireNonNull(boundarySupplier, "boundarySupplier is null");
- ObjectHelper.requireNonNull(bufferSupplier, "bufferSupplier is null");
- return RxJavaPlugins.onAssembly(new ObservableBufferBoundarySupplier(this, boundarySupplier, bufferSupplier));
- }
-
/**
* Returns an Observable that subscribes to this ObservableSource lazily, caches all of its events
* and replays them, in the same order as received, to all the downstream subscribers.
@@ -10115,7 +10051,7 @@ public final Observable ofType(final Class clazz) {
@SchedulerSupport(SchedulerSupport.NONE)
public final Observable onErrorResumeNext(Function super Throwable, ? extends ObservableSource extends T>> resumeFunction) {
ObjectHelper.requireNonNull(resumeFunction, "resumeFunction is null");
- return RxJavaPlugins.onAssembly(new ObservableOnErrorNext(this, resumeFunction, false));
+ return RxJavaPlugins.onAssembly(new ObservableOnErrorNext(this, resumeFunction));
}
/**
@@ -10220,45 +10156,6 @@ public final Observable onErrorReturnItem(final T item) {
return onErrorReturn(Functions.justFunction(item));
}
- /**
- * Instructs an ObservableSource to pass control to another ObservableSource rather than invoking
- * {@link Observer#onError onError} if it encounters an {@link java.lang.Exception}.
- *
- * This differs from {@link #onErrorResumeNext} in that this one does not handle {@link java.lang.Throwable}
- * or {@link java.lang.Error} but lets those continue through.
- *
- *
- *
- * By default, when an ObservableSource encounters an exception that prevents it from emitting the expected item
- * to its {@link Observer}, the ObservableSource invokes its Observer's {@code onError} method, and then quits
- * without invoking any more of its Observer's methods. The {@code onExceptionResumeNext} method changes
- * this behavior. If you pass another ObservableSource ({@code resumeSequence}) to an ObservableSource's
- * {@code onExceptionResumeNext} method, if the original ObservableSource encounters an exception, instead of
- * invoking its Observer's {@code onError} method, it will instead relinquish control to
- * {@code resumeSequence} which will invoke the Observer's {@link Observer#onNext onNext} method if it is
- * able to do so. In such a case, because no ObservableSource necessarily invokes {@code onError}, the Observer
- * may never know that an exception happened.
- *
- * You can use this to prevent exceptions from propagating or to supply fallback data should exceptions be
- * encountered.
- *
- *
Scheduler:
- *
{@code onExceptionResumeNext} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param next
- * the next ObservableSource that will take over if the source ObservableSource encounters
- * an exception
- * @return the original ObservableSource, with appropriately modified behavior
- * @see ReactiveX operators documentation: Catch
- */
- @CheckReturnValue
- @SchedulerSupport(SchedulerSupport.NONE)
- public final Observable onExceptionResumeNext(final ObservableSource extends T> next) {
- ObjectHelper.requireNonNull(next, "next is null");
- return RxJavaPlugins.onAssembly(new ObservableOnErrorNext(this, Functions.justFunction(next), true));
- }
-
/**
* Nulls out references to the upstream producer and downstream Observer if
* the sequence is terminated or downstream calls dispose().
@@ -15175,62 +15072,6 @@ public final Observable> window(
return RxJavaPlugins.onAssembly(new ObservableWindowBoundarySelector(this, openingIndicator, closingIndicator, bufferSize));
}
- /**
- * Returns an Observable that emits windows of items it collects from the source ObservableSource. The resulting
- * ObservableSource emits connected, non-overlapping windows. It emits the current window and opens a new one
- * whenever the ObservableSource produced by the specified {@code closingIndicator} emits an item.
- *
- *
- *
- *
Scheduler:
- *
This version of {@code window} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param the element type of the boundary ObservableSource
- * @param boundary
- * a {@link Supplier} that returns an {@code ObservableSource} that governs the boundary between windows.
- * When the source {@code ObservableSource} emits an item, {@code window} emits the current window and begins
- * a new one.
- * @return an Observable that emits connected, non-overlapping windows of items from the source ObservableSource
- * whenever {@code closingIndicator} emits an item
- * @see ReactiveX operators documentation: Window
- */
- @CheckReturnValue
- @SchedulerSupport(SchedulerSupport.NONE)
- public final Observable> window(Supplier extends ObservableSource> boundary) {
- return window(boundary, bufferSize());
- }
-
- /**
- * Returns an Observable that emits windows of items it collects from the source ObservableSource. The resulting
- * ObservableSource emits connected, non-overlapping windows. It emits the current window and opens a new one
- * whenever the ObservableSource produced by the specified {@code closingIndicator} emits an item.
- *
- *
- *
- *
Scheduler:
- *
This version of {@code window} does not operate by default on a particular {@link Scheduler}.
- *
- *
- * @param the element type of the boundary ObservableSource
- * @param boundary
- * a {@link Supplier} that returns an {@code ObservableSource} that governs the boundary between windows.
- * When the source {@code ObservableSource} emits an item, {@code window} emits the current window and begins
- * a new one.
- * @param bufferSize
- * the capacity hint for the buffer in the inner windows
- * @return an Observable that emits connected, non-overlapping windows of items from the source ObservableSource
- * whenever {@code closingIndicator} emits an item
- * @see ReactiveX operators documentation: Window
- */
- @CheckReturnValue
- @SchedulerSupport(SchedulerSupport.NONE)
- public final Observable> window(Supplier extends ObservableSource> boundary, int bufferSize) {
- ObjectHelper.requireNonNull(boundary, "boundary is null");
- ObjectHelper.verifyPositive(bufferSize, "bufferSize");
- return RxJavaPlugins.onAssembly(new ObservableWindowBoundarySupplier(this, boundary, bufferSize));
- }
-
/**
* Merges the specified ObservableSource into this ObservableSource sequence by using the {@code resultSelector}
* function only when the source ObservableSource (this instance) emits an item.
diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundarySupplier.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundarySupplier.java
deleted file mode 100644
index 362acb9645..0000000000
--- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferBoundarySupplier.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/**
- * Copyright (c) 2016-present, RxJava Contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
- * the License for the specific language governing permissions and limitations under the License.
- */
-
-package io.reactivex.internal.operators.flowable;
-
-import java.util.Collection;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.reactivestreams.*;
-
-import io.reactivex.*;
-import io.reactivex.disposables.Disposable;
-import io.reactivex.exceptions.Exceptions;
-import io.reactivex.functions.Supplier;
-import io.reactivex.internal.disposables.DisposableHelper;
-import io.reactivex.internal.functions.ObjectHelper;
-import io.reactivex.internal.queue.MpscLinkedQueue;
-import io.reactivex.internal.subscribers.QueueDrainSubscriber;
-import io.reactivex.internal.subscriptions.*;
-import io.reactivex.internal.util.QueueDrainHelper;
-import io.reactivex.plugins.RxJavaPlugins;
-import io.reactivex.subscribers.*;
-
-public final class FlowableBufferBoundarySupplier, B>
-extends AbstractFlowableWithUpstream {
- final Supplier extends Publisher> boundarySupplier;
- final Supplier bufferSupplier;
-
- public FlowableBufferBoundarySupplier(Flowable source, Supplier extends Publisher> boundarySupplier, Supplier bufferSupplier) {
- super(source);
- this.boundarySupplier = boundarySupplier;
- this.bufferSupplier = bufferSupplier;
- }
-
- @Override
- protected void subscribeActual(Subscriber super U> s) {
- source.subscribe(new BufferBoundarySupplierSubscriber(new SerializedSubscriber(s), bufferSupplier, boundarySupplier));
- }
-
- static final class BufferBoundarySupplierSubscriber, B>
- extends QueueDrainSubscriber implements FlowableSubscriber, Subscription, Disposable {
-
- final Supplier bufferSupplier;
- final Supplier extends Publisher> boundarySupplier;
-
- Subscription upstream;
-
- final AtomicReference other = new AtomicReference();
-
- U buffer;
-
- BufferBoundarySupplierSubscriber(Subscriber super U> actual, Supplier bufferSupplier,
- Supplier extends Publisher> boundarySupplier) {
- super(actual, new MpscLinkedQueue());
- this.bufferSupplier = bufferSupplier;
- this.boundarySupplier = boundarySupplier;
- }
-
- @Override
- public void onSubscribe(Subscription s) {
- if (!SubscriptionHelper.validate(this.upstream, s)) {
- return;
- }
- this.upstream = s;
-
- Subscriber super U> actual = this.downstream;
-
- U b;
-
- try {
- b = ObjectHelper.requireNonNull(bufferSupplier.get(), "The buffer supplied is null");
- } catch (Throwable e) {
- Exceptions.throwIfFatal(e);
- cancelled = true;
- s.cancel();
- EmptySubscription.error(e, actual);
- return;
- }
-
- buffer = b;
-
- Publisher boundary;
-
- try {
- boundary = ObjectHelper.requireNonNull(boundarySupplier.get(), "The boundary publisher supplied is null");
- } catch (Throwable ex) {
- Exceptions.throwIfFatal(ex);
- cancelled = true;
- s.cancel();
- EmptySubscription.error(ex, actual);
- return;
- }
-
- BufferBoundarySubscriber bs = new BufferBoundarySubscriber(this);
- other.set(bs);
-
- actual.onSubscribe(this);
-
- if (!cancelled) {
- s.request(Long.MAX_VALUE);
-
- boundary.subscribe(bs);
- }
- }
-
- @Override
- public void onNext(T t) {
- synchronized (this) {
- U b = buffer;
- if (b == null) {
- return;
- }
- b.add(t);
- }
- }
-
- @Override
- public void onError(Throwable t) {
- cancel();
- downstream.onError(t);
- }
-
- @Override
- public void onComplete() {
- U b;
- synchronized (this) {
- b = buffer;
- if (b == null) {
- return;
- }
- buffer = null;
- }
- queue.offer(b);
- done = true;
- if (enter()) {
- QueueDrainHelper.drainMaxLoop(queue, downstream, false, this, this);
- }
- }
-
- @Override
- public void request(long n) {
- requested(n);
- }
-
- @Override
- public void cancel() {
- if (!cancelled) {
- cancelled = true;
- upstream.cancel();
- disposeOther();
-
- if (enter()) {
- queue.clear();
- }
- }
- }
-
- void disposeOther() {
- DisposableHelper.dispose(other);
- }
-
- void next() {
-
- U next;
-
- try {
- next = ObjectHelper.requireNonNull(bufferSupplier.get(), "The buffer supplied is null");
- } catch (Throwable e) {
- Exceptions.throwIfFatal(e);
- cancel();
- downstream.onError(e);
- return;
- }
-
- Publisher boundary;
-
- try {
- boundary = ObjectHelper.requireNonNull(boundarySupplier.get(), "The boundary publisher supplied is null");
- } catch (Throwable ex) {
- Exceptions.throwIfFatal(ex);
- cancelled = true;
- upstream.cancel();
- downstream.onError(ex);
- return;
- }
-
- BufferBoundarySubscriber bs = new BufferBoundarySubscriber(this);
-
- if (DisposableHelper.replace(other, bs)) {
- U b;
- synchronized (this) {
- b = buffer;
- if (b == null) {
- return;
- }
- buffer = next;
- }
-
- boundary.subscribe(bs);
-
- fastPathEmitMax(b, false, this);
- }
- }
-
- @Override
- public void dispose() {
- upstream.cancel();
- disposeOther();
- }
-
- @Override
- public boolean isDisposed() {
- return other.get() == DisposableHelper.DISPOSED;
- }
-
- @Override
- public boolean accept(Subscriber super U> a, U v) {
- downstream.onNext(v);
- return true;
- }
-
- }
-
- static final class BufferBoundarySubscriber, B> extends DisposableSubscriber {
- final BufferBoundarySupplierSubscriber parent;
-
- boolean once;
-
- BufferBoundarySubscriber(BufferBoundarySupplierSubscriber parent) {
- this.parent = parent;
- }
-
- @Override
- public void onNext(B t) {
- if (once) {
- return;
- }
- once = true;
- cancel();
- parent.next();
- }
-
- @Override
- public void onError(Throwable t) {
- if (once) {
- RxJavaPlugins.onError(t);
- return;
- }
- once = true;
- parent.onError(t);
- }
-
- @Override
- public void onComplete() {
- if (once) {
- return;
- }
- once = true;
- parent.next();
- }
- }
-}
diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorNext.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorNext.java
index 7110d086e0..8fa826e08c 100644
--- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorNext.java
+++ b/src/main/java/io/reactivex/internal/operators/flowable/FlowableOnErrorNext.java
@@ -24,18 +24,16 @@
public final class FlowableOnErrorNext extends AbstractFlowableWithUpstream {
final Function super Throwable, ? extends Publisher extends T>> nextSupplier;
- final boolean allowFatal;
public FlowableOnErrorNext(Flowable source,
- Function super Throwable, ? extends Publisher extends T>> nextSupplier, boolean allowFatal) {
+ Function super Throwable, ? extends Publisher extends T>> nextSupplier) {
super(source);
this.nextSupplier = nextSupplier;
- this.allowFatal = allowFatal;
}
@Override
protected void subscribeActual(Subscriber super T> s) {
- OnErrorNextSubscriber parent = new OnErrorNextSubscriber(s, nextSupplier, allowFatal);
+ OnErrorNextSubscriber parent = new OnErrorNextSubscriber(s, nextSupplier);
s.onSubscribe(parent);
source.subscribe(parent);
}
@@ -49,19 +47,16 @@ static final class OnErrorNextSubscriber
final Function super Throwable, ? extends Publisher extends T>> nextSupplier;
- final boolean allowFatal;
-
boolean once;
boolean done;
long produced;
- OnErrorNextSubscriber(Subscriber super T> actual, Function super Throwable, ? extends Publisher extends T>> nextSupplier, boolean allowFatal) {
+ OnErrorNextSubscriber(Subscriber super T> actual, Function super Throwable, ? extends Publisher extends T>> nextSupplier) {
super(false);
this.downstream = actual;
this.nextSupplier = nextSupplier;
- this.allowFatal = allowFatal;
}
@Override
@@ -92,11 +87,6 @@ public void onError(Throwable t) {
}
once = true;
- if (allowFatal && !(t instanceof Exception)) {
- downstream.onError(t);
- return;
- }
-
Publisher extends T> p;
try {
diff --git a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySupplier.java b/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySupplier.java
deleted file mode 100644
index 50ddca4e22..0000000000
--- a/src/main/java/io/reactivex/internal/operators/flowable/FlowableWindowBoundarySupplier.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/**
- * Copyright (c) 2016-present, RxJava Contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
- * the License for the specific language governing permissions and limitations under the License.
- */
-
-package io.reactivex.internal.operators.flowable;
-
-import java.util.concurrent.atomic.*;
-
-import org.reactivestreams.*;
-
-import io.reactivex.*;
-import io.reactivex.disposables.Disposable;
-import io.reactivex.exceptions.*;
-import io.reactivex.functions.Supplier;
-import io.reactivex.internal.functions.ObjectHelper;
-import io.reactivex.internal.queue.MpscLinkedQueue;
-import io.reactivex.internal.subscriptions.SubscriptionHelper;
-import io.reactivex.internal.util.*;
-import io.reactivex.plugins.RxJavaPlugins;
-import io.reactivex.processors.UnicastProcessor;
-import io.reactivex.subscribers.DisposableSubscriber;
-
-public final class FlowableWindowBoundarySupplier extends AbstractFlowableWithUpstream> {
- final Supplier extends Publisher> other;
- final int capacityHint;
-
- public FlowableWindowBoundarySupplier(Flowable source,
- Supplier extends Publisher> other, int capacityHint) {
- super(source);
- this.other = other;
- this.capacityHint = capacityHint;
- }
-
- @Override
- protected void subscribeActual(Subscriber super Flowable> subscriber) {
- WindowBoundaryMainSubscriber parent = new WindowBoundaryMainSubscriber(subscriber, capacityHint, other);
-
- source.subscribe(parent);
- }
-
- static final class WindowBoundaryMainSubscriber
- extends AtomicInteger
- implements FlowableSubscriber, Subscription, Runnable {
-
- private static final long serialVersionUID = 2233020065421370272L;
-
- final Subscriber super Flowable> downstream;
-
- final int capacityHint;
-
- final AtomicReference> boundarySubscriber;
-
- static final WindowBoundaryInnerSubscriber