The parallel scheduler

The Schedulers.parallel scheduler executes work on a multiple-worker thread pool. It creates workers based on the number of available processors. This is the default scheduler used in various Reactor operators. Consider the following code:

@Test    public void testParalleScheduler() throws Exception{       // Removed for Brevity        fibonacciGenerator                .delayElements(Duration.ofNanos(10),Schedulers.parallel())                .doOnNext(x -> print("Next value is  "+x))                .doFinally(x -> print("Closing "))           .subscribe(x -> print("Sub received : "+x));      Thread.sleep(500); }

From the output, we can validate that all of the tasks in the chain are executed on paralle-1 and parallel-2 threads. Go through the following screenshot:

Similar to the single scheduler, ...

Get Hands-On Reactive Programming with Reactor now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.