use of reactor.core.scheduler.Schedulers.parallel in project reactor-core by reactor.
the class FluxPeekFuseableTest method should_reduce_to_10_events_conditional.
@Test
public void should_reduce_to_10_events_conditional() {
for (int i = 0; i < 20; i++) {
AtomicInteger count = new AtomicInteger();
Flux.range(0, 10).flatMap(x -> Flux.range(0, 2).map(y -> blockingOp(x, y)).subscribeOn(Schedulers.parallel()).reduce((l, r) -> l + "_" + r).doOnSuccess(s -> {
count.incrementAndGet();
}).filter(v -> true)).blockLast();
assertEquals(10, count.get());
}
}
use of reactor.core.scheduler.Schedulers.parallel in project reactor-core by reactor.
the class FluxPeekFuseableTest method should_reduce_to_10_events.
@Test
public void should_reduce_to_10_events() {
for (int i = 0; i < 20; i++) {
int n = i;
List<Integer> rs = Collections.synchronizedList(new ArrayList<>());
AtomicInteger count = new AtomicInteger();
Flux.range(0, 10).flatMap(x -> Flux.range(0, 2).doOnNext(rs::add).map(y -> blockingOp(x, y)).subscribeOn(Schedulers.parallel()).reduce((l, r) -> l + "_" + r + " (" + x + ", it:" + n + ")")).doOnNext(s -> {
count.incrementAndGet();
}).blockLast();
assertEquals(10, count.get());
}
}
Aggregations