June 2017
Intermediate to advanced
400 pages
8h 44m
English
You can build a Scheduler off a standard Java ExecutorService. 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 specified with this number of threads. Then, you can wrap it inside a Scheduler implementation by calling Schedulers.from():
import io.reactivex.Observable;import io.reactivex.Scheduler;import io.reactivex.schedulers.Schedulers;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;public class Launcher { public static void main(String[] args) { int numberOfThreads = 20; ExecutorService executor = Executors.newFixedThreadPool ...
Read now
Unlock full access