目前<init-param>
<param-name>appUrl</param-name>
<param-value>${app.url}</param-value>
</init-param>
总是在doOnTerminate(...)
主题上调用,IO Scheduler
doOnUnsubscribe(...)
上调用UI thread Scheduler
fun <T> withTransaction(sourceObservable: Observable<T>): Observable<T> {
...
return Observable.empty<T>()
.doOnCompleted { startTransaction() }
.mergeWith(sourceObservable)
.doOnNext { setTransactionSuccessful() }
.doOnTerminate(...) // called on RxIoScheduler-2 thread
.doOnUnsubscribe(...) // called on main thread
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io()) // didn't help
}
如何强制在IO线程上执行doOnUnsubscribe?