Closed
Description
While migrating some code from 1.2.x to 2.0 I've noticed a difference:
-
1.2.x :
Observable.doOnUnsubscribe()
is always called whenever an observable chain terminates, either because it's been explicitly terminated withSubscription.unsubscribe()
or becauseonComplete()
oronError()
have been called.
This is the way I usually used to insert side effects on chain termination. -
2.x : there is no
Observable.doOnUnsubscribe()
so I've resorted usingObservable.doOnDispose()
instead but this one is called only when explicitly terminating an observable chain withDisposable.dispose();
I'm assuming this difference is intended (i.e. not a bug) so how can we 'insert' side effects on chain termination with RxJava 2.0?