Last active
December 1, 2018 13:10
-
-
Save Diolor/268bbfe6cb2d4cde6a377c31a0c216ba 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 printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
val connectable = just(Unit) | |
.replay().refCount() | |
connectable | |
.subscribeOn(newThread()) | |
.subscribe { | |
printCurrentThread("subscribe onNext 1") | |
} | |
connectable | |
.subscribeOn(computation()) | |
.subscribe { | |
printCurrentThread("subscribe onNext 2") | |
} | |
connectable | |
.subscribe { | |
printCurrentThread("subscribe onNext 3") | |
} | |
Thread.sleep(1000L) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment