Last active
February 1, 2021 22:32
-
-
Save longv/1016eb2bf2f179eaf6824fc64945454f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun debugSubscribeOn(): Disposable = | |
Observable.just(1) | |
.doOnNext { | |
println(Thread.currentThread().name) // RxCachedThreadScheduler-1 | |
} | |
.subscribeOn(Schedulers.io()) | |
.flatMap { | |
println(Thread.currentThread().name) // RxCachedThreadScheduler-1 | |
Observable.just(it) | |
.subscribeOn(Schedulers.computation()) | |
.doOnNext { | |
println(Thread.currentThread().name) // RxComputationThreadPool-1 | |
} | |
} | |
.subscribeOn(Schedulers.newThread()) | |
.doOnNext { | |
println(Thread.currentThread().name) // RxComputationThreadPool-1 | |
} | |
.subscribe() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment