Skip to content

1.x: DoOnUnsubscribe javadoc clarifications #3907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -4774,13 +4774,21 @@ public final Observable<T> doOnTerminate(final Action0 onTerminate) {
}

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