The elastic scheduler

The Schedulers.elastic scheduler executes work on a multiple-worker thread pool. Each of the executed workers can execute long-lived tasks that ask for a blocking operation. Each worker is returned to the pool when the task finishes. There is also an idle time associated with the worker, after which the worked is disposed. The scheduler tries to consume an existing idle worker, but if there aren't any, the scheduler dynamically generates one and schedules the task on it. The following code shows this:

@Test    public void testElasticSchedular() throws Exception{       // Removed for Brevity        fibonacciGenerator                .filter(x -> {                    print("Executing Filter");                    return x < 100;                }).delayElements(Duration.ZERO,Schedulers.elastic()) .window(10) ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.