src/main/java/io/reactivex/Flowable.java
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.PASS_THROUGH)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Flowable<T> doOnCancel(Action onCancel) {
        return doOnLifecycle(Functions.emptyConsumer(), Functions.EMPTY_LONG_CONSUMER, onCancel);
    }
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.PASS_THROUGH)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Flowable<T> doOnCancel(Action onCancel) {
        return doOnLifecycle(Functions.emptyConsumer(), Functions.EMPTY_LONG_CONSUMER, onCancel);
    }
Calls the cancel {@code Action} if the downstream cancels 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 onCancel()} 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 Publisher} 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 doOnCancel} 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 doOnCancel} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param onCancel
the action that gets called when the source {@code Publisher}'s Subscription is canceled
@return the source {@code Publisher} modified so as to call this Action when appropriate
@see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>