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

NewThread

NewThread is a Scheduler (created by calling Schedulers.newThread()) where things are finally starting to get interesting. What it does is to create a new thread for each Observable when it becomes active, simple as that.

Basically, NewThread can be used anywhere whenever there is a need to offload computation from the current (main) thread. However, creating a new thread for each Observable can be costly in the long run, as thread creation is a relatively heavyweight operation and there are other Schedulers that might be better suited for computation offloading.

One thing to keep in mind is that this Scheduler doesn't place any limits on the number of threads that will be created. This might not be a problem for Observables that ...

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