February 2020
Intermediate to advanced
412 pages
9h 36m
English
The Schedulers.newThread() factory returns a Scheduler that does not pool threads at all. It creates a new thread for each Observer and then destroys the thread when it is not needed anymore. This is different to Schedulers.io() because it does not attempt to persist and cache threads for reuse. The following is an example of the Schedulers.newThread() factory method usage:
Observable.just("Alpha", "Beta", "Gamma", "Delta", "Epsilon") .subscribeOn(Schedulers.newThread());
This may be helpful in cases where you want to create, use, and then destroy a thread immediately so that it does not take up memory. But for complex applications generally, you will want to use Schedulers.io() so that there is some attempt to reuse threads if ...
Read now
Unlock full access