/** * Request all elements to be processed from the processing Stream */ public void requestAll() { request(Long.MAX_VALUE); }
/** * Request all elements to be processed asynchronously in the processing stream * * @return New ReactiveTask that references the execution of the new async task */ public ReactiveTask requestAllAsync() { return requestAsync(Long.MAX_VALUE); }
/** * Asyncrhonously request more elements from the Stream * * @param n Number of elements to request * @return New ReactiveTask that references the execution of the new async task */ public ReactiveTask requestAsync(final long n) { return withSubscriptionAndTask(subscriptionAndTask.map2(c -> CompletableFuture.runAsync(() -> subscriptionAndTask._1().join() .request(n), exec))); }
@Override public <X extends Throwable> ReactiveTask forEach(final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError) { return new ReactiveTask( exec, LazyFutureStreamUtils.forEachWithError(stream, consumerElement, consumerError) .map2(r -> CompletableFuture.runAsync(r, exec))); }
@Override public <X extends Throwable> ReactiveTask forEach(final long numberOfElements, final Consumer<? super T> consumer, final Consumer<? super Throwable> consumerError, final Runnable onComplete) { return new ReactiveTask( exec, LazyFutureStreamUtils.forEachXEvents(stream, numberOfElements, consumer, consumerError, onComplete) .map2(r -> CompletableFuture.runAsync(r, exec))); }
/** * Asyncrhonously request more elements from the Stream * * @param n Number of elements to request * @return New ReactiveTask that references the execution of the new async task */ public ReactiveTask requestAsync(final long n) { return withSubscriptionAndTask(subscriptionAndTask.map2(c -> CompletableFuture.runAsync(() -> subscriptionAndTask._1().join() .request(n), exec))); }
/** * Request all elements to be processed from the processing Stream */ public void requestAll() { request(Long.MAX_VALUE); }
/** * Request all elements to be processed asynchronously in the processing stream * * @return New ReactiveTask that references the execution of the new async task */ public ReactiveTask requestAllAsync() { return requestAsync(Long.MAX_VALUE); }
@Override public <X extends Throwable> ReactiveTask forEach(final long numberOfElements, final Consumer<? super T> consumer) { return new ReactiveTask( exec, LazyFutureStreamUtils.forEachX(stream, numberOfElements, consumer) .map2(r -> CompletableFuture.runAsync(r, exec))); }
@Override public <X extends Throwable> ReactiveTask forEach(final long numberOfElements, final Consumer<? super T> consumer, final Consumer<? super Throwable> consumerError) { return new ReactiveTask( exec, LazyFutureStreamUtils.forEachXWithError(stream, numberOfElements, consumer, consumerError) .map2(r -> CompletableFuture.runAsync(r, exec))); }
@Override public <X extends Throwable> ReactiveTask forEach(final Consumer<? super T> consumerElement, final Consumer<? super Throwable> consumerError, final Runnable onComplete) { return new ReactiveTask( exec, LazyFutureStreamUtils.forEachEvent(stream, consumerElement, consumerError, onComplete) .map2(r -> CompletableFuture.runAsync(r, exec))); } }