Canceling an Observable in RxJava 2.x
Observable.fromFuture's javadoc says "Unlike 1.x, cancelling the Observable won't cancel the future. If necessary, one can use composition to achieve the cancellation effect: futureObservableSource.doOnCancel(() -> future.cancel(true));."
Flowable has this method and it works as expected like this:
Disposable disposable = Flowable.fromFuture(response, Schedulers.io())
.doOnCancel(() -> response.cancel(true))
.subscribe();
But Observable seems to lack doOnCancel method, doesn't it? Tested RxJava's version is 2.1.10.
Its equivalent is doOnDispose. A copy-paste error. PR welcome.
Hello, Does someone work on this topic? I would like to start contributing, can I do it?
@RomanWuattier You can start working on this.
Closing via #5948.