Skip to content

Commit 5293fd0

Browse files
committed
1.x: DoOnUnsubscribe javadoc clarifications (#3907)
1 parent 4874bbe commit 5293fd0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/main/java/rx/Observable.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4774,13 +4774,21 @@ public final Observable<T> doOnTerminate(final Action0 onTerminate) {
47744774
}
47754775

47764776
/**
4777-
* Modifies the source {@code Observable} so that it invokes the given action when it is unsubscribed from
4778-
* its subscribers. Each un-subscription will result in an invocation of the given action except when the
4779-
* source {@code Observable} is reference counted, in which case the source {@code Observable} will invoke
4780-
* the given action for the very last un-subscription.
4777+
* Calls the unsubscribe {@code Action0} if the downstream unsubscribes the sequence.
4778+
* <p>
4779+
* The action is shared between subscriptions and thus may be called concurrently from multiple
4780+
* threads; the action must be thread safe.
4781+
* <p>
4782+
* If the action throws a runtime exception, that exception is rethrown by the {@code unsubscribe()} call,
4783+
* sometimes as a {@code CompositeException} if there were multiple exceptions along the way.
4784+
* <p>
4785+
* Note that terminal events trigger the action unless the {@code Observable} is subscribed to via {@code unsafeSubscribe()}.
47814786
* <p>
47824787
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doOnUnsubscribe.png" alt="">
47834788
* <dl>
4789+
* <dt><b>Backpressure:</b></dt>
4790+
* <dd>{@code doOnUnsubscribe} does not interact with backpressure requests or value delivery; backpressure
4791+
* behavior is preserved between its upstream and its downstream.</dd>
47844792
* <dt><b>Scheduler:</b></dt>
47854793
* <dd>{@code doOnUnsubscribe} does not operate by default on a particular {@link Scheduler}.</dd>
47864794
* </dl>

0 commit comments

Comments
 (0)