December 2017
Intermediate to advanced
322 pages
7h 3m
English
Schedulers.single() and Schedulers.trampoline() sound somewhat similar, both the schedulers are for sequential execution. While Schedulers.single() guarantees that all its task will run sequentially, it may run parallel to the thread it was called upon (if not, that thread is from Schedulers.single() as well); the Schedulers.trampoline() is different in that sector.
Unlike maintaining a thread to its disposal like Schedulers.single(), Schedulers.trampoline() queues up the task on the thread it was called on.
So, it'll be sequential with the thread it was called upon.
Let's look at some examples of Schedulers.single() and Schedulers.trampoline() to understand them better:
fun main(args: Array<String>) { async(CommonPool) ...Read now
Unlock full access