O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executor Scheduler

One of the last Schedulers that we will cover is the Executor Scheduler. It was created to consume a custom pool created with an Executors class from the java.util.concurrent package. An example of how that can be done looks like this:

final ExecutorService executor = Executors.newFixedThreadPool(10);final Scheduler pooledScheduler = Schedulers.from(executor);

Then, it's just a matter of passing and using it in .subscribeOn():

.subscribeOn(pooledScheduler)

This Scheduler can be used to create bounded worker pools that can replace IO Scheduler in cases where the chance of creating lots of Observables is quite likely.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required