doOnUnsubscribe is only in RX1. In RX2, it is similar to (doOnDispose ReactiveX/RxJava#4811) but it different
Observable completion/error
- doOnTerminate called
- doOnUnsubscribe called
Programatic call to unsubscribe before Observable completes (subscribe.unsubscribe()
)
- doOnTerminate don't called
- doOnUnsubscribe called
=> In RX1, if we want to detect something run after stream finished by anyway, we should use
doOnUnsubscribe
=> In RX2, we can use doOnFinish method