Skip to content

Commit 67a951b

Browse files
Mauinakarnokd
authored andcommitted
Improve doOnDispose JavaDoc (ReactiveX#5296)
* correct javadoc note in Observable.doOnDispose() The note was claiming Observable.doOnDispose() would be called for terminal events of the Observable, which is not the case * small improvement to .doOnDispose javadocs to refer to Actions * add @throws mentions to doOnDisposed javadocs
1 parent 5ab2083 commit 67a951b

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/main/java/io/reactivex/Completable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,13 +1107,13 @@ public final Completable doOnComplete(Action onComplete) {
11071107
}
11081108

11091109
/**
1110-
* Returns a Completable which calls the given onDispose callback if the child subscriber cancels
1111-
* the subscription.
1110+
* Calls the shared {@code Action} if a CompletableObserver subscribed to the current
1111+
* Completable disposes the common Disposable it received via onSubscribe.
11121112
* <dl>
11131113
* <dt><b>Scheduler:</b></dt>
11141114
* <dd>{@code doOnDispose} does not operate by default on a particular {@link Scheduler}.</dd>
11151115
* </dl>
1116-
* @param onDispose the callback to call when the child subscriber disposes the subscription
1116+
* @param onDispose the action to call when the child subscriber disposes the subscription
11171117
* @return the new Completable instance
11181118
* @throws NullPointerException if onDispose is null
11191119
*/

src/main/java/io/reactivex/Maybe.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,13 +2441,14 @@ public final Maybe<T> doFinally(Action onFinally) {
24412441
}
24422442

24432443
/**
2444-
* Calls the shared runnable if a MaybeObserver subscribed to the current Maybe
2444+
* Calls the shared {@code Action} if a MaybeObserver subscribed to the current Maybe
24452445
* disposes the common Disposable it received via onSubscribe.
24462446
* <dl>
24472447
* <dt><b>Scheduler:</b></dt>
24482448
* <dd>{@code doOnDispose} does not operate by default on a particular {@link Scheduler}.</dd>
24492449
* </dl>
2450-
* @param onDispose the runnable called when the subscription is cancelled (disposed)
2450+
* @param onDispose the action called when the subscription is cancelled (disposed)
2451+
* @throws NullPointerException if onDispose is null
24512452
* @return the new Maybe instance
24522453
*/
24532454
@CheckReturnValue

src/main/java/io/reactivex/Observable.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6895,8 +6895,6 @@ public final Observable<T> doFinally(Action onFinally) {
68956895
* If the action throws a runtime exception, that exception is rethrown by the {@code dispose()} call,
68966896
* sometimes as a {@code CompositeException} if there were multiple exceptions along the way.
68976897
* <p>
6898-
* Note that terminal events trigger the action unless the {@code ObservableSource} is subscribed to via {@code unsafeSubscribe()}.
6899-
* <p>
69006898
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doOnUnsubscribe.png" alt="">
69016899
* <dl>
69026900
* <dt><b>Scheduler:</b></dt>
@@ -6906,6 +6904,7 @@ public final Observable<T> doFinally(Action onFinally) {
69066904
* @param onDispose
69076905
* the action that gets called when the source {@code ObservableSource}'s Disposable is disposed
69086906
* @return the source {@code ObservableSource} modified so as to call this Action when appropriate
6907+
* @throws NullPointerException if onDispose is null
69096908
* @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
69106909
*/
69116910
@CheckReturnValue

src/main/java/io/reactivex/Single.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,14 +1926,15 @@ public final Single<T> doOnError(final Consumer<? super Throwable> onError) {
19261926
}
19271927

19281928
/**
1929-
* Calls the shared runnable if a SingleObserver subscribed to the current Single
1929+
* Calls the shared {@code Action} if a SingleObserver subscribed to the current Single
19301930
* disposes the common Disposable it received via onSubscribe.
19311931
* <dl>
19321932
* <dt><b>Scheduler:</b></dt>
19331933
* <dd>{@code doOnDispose} does not operate by default on a particular {@link Scheduler}.</dd>
19341934
* </dl>
1935-
* @param onDispose the runnable called when the subscription is disposed
1935+
* @param onDispose the action called when the subscription is disposed
19361936
* @return the new Single instance
1937+
* @throws NullPointerException if onDispose is null
19371938
* @since 2.0
19381939
*/
19391940
@CheckReturnValue

0 commit comments

Comments
 (0)