Skip to content

Instantly share code, notes, and snippets.

@Diolor
Last active December 1, 2018 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Diolor/296c244495b1faacc86d4ae36476ffe5 to your computer and use it in GitHub Desktop.
Save Diolor/296c244495b1faacc86d4ae36476ffe5 to your computer and use it in GitHub Desktop.
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(computation())
.subscribe {
printCurrentThread("subscribe onNext 1")
}
connectable.subscribe {
printCurrentThread("subscribe onNext 2")
}
Thread.sleep(1000L)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment