src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> doOnDispose(Action onDispose) {
        return doOnLifecycle(Functions.emptyConsumer(), onDispose);
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> doOnDispose(Action onDispose) {
        return doOnLifecycle(Functions.emptyConsumer(), onDispose);
    }
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doOnDispose ( Action onDispose ) { return doOnLifecycle ( Functions . emptyConsumer ( ) , onDispose ) ; }
Calls the dispose {@code Action} if the downstream disposes 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 dispose()} call,
sometimes as a {@code CompositeException} if there were multiple exceptions along the way.
<p>
<img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doOnDispose.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code doOnDispose} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param onDispose
the action that gets called when the source {@code ObservableSource}'s Disposable is disposed
@return the source {@code ObservableSource} modified so as to call this Action when appropriate
@throws NullPointerException if onDispose is null
@see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
Calls the dispose { @code Action } if the downstream disposes 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 dispose () } call sometimes as a { @code CompositeException } if there were multiple exceptions along the way . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnDispose . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code doOnDispose } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >