Understanding schedulers
As discussed earlier, thread pools are a collection of threads. Depending on the policy of that thread pool, threads may be persisted and maintained so they can be reused. A queue of tasks is then executed by the threads from that pool.
Some thread pools hold a fixed number of threads (such as a thread created by the computation() method we used earlier), while others dynamically create and destroy threads as needed.
Typically, in Java, you use an ExecutorService as a thread pool. However, RxJava implements its own concurrency abstraction called Scheduler. This defines methods and rules that an actual concurrency provider such as an ExecutorService or actor system must obey. The construct flexibly renders RxJava non-opinionated ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access