February 2020
Intermediate to advanced
412 pages
9h 36m
English
I/O tasks, such as reading from and writing to databases, web requests, and disk storage use little CPU power and often have idle time waiting for the data to be sent or received. This allows threads to be created more liberally, and Schedulers.io() is appropriate for this. It maintains as many threads as there are tasks and dynamically grows the number of threads, caches them, and discards the threads when they are not needed.
For instance, you may use Schedulers.io() to perform SQL operations using RxJava-JDBC (https://github.com/davidmcoten/rxjava2-jdbc):
Database db = Database.from(conn); Observable<String> customerNames = db.select("select name from customer") .getAs(String.class) .subscribeOn(Schedulers.io());
But you have to ...
Read now
Unlock full access