February 2020
Intermediate to advanced
412 pages
9h 36m
English
It is also possible to build a Scheduler from a standard Java ExecutorService pool. You may choose to do this in order to have more custom and fine-tuned control over your thread management policies. For example, say we want to create a Scheduler that uses 20 threads. We can create a new fixed ExecutorService pool with the specified number of threads. Then, you can wrap it inside a Scheduler implementation by calling Schedulers.from(), as demonstrated in the following example:
import io.reactivex.rxjava3.core.Observable;import io.reactivex.rxjava3.core.Scheduler;import io.reactivex.rxjava3.schedulers.Schedulers;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;public class Ch6_07 { public static ...
Read now
Unlock full access