public class EagerReact extends BaseSimpleReact
| Constructor and Description |
|---|
EagerReact()
Construct a EagerReact builder using standard thread pool.
|
EagerReact(java.util.concurrent.ExecutorService executor)
Construct a EagerReact builder with provided ExecutorService
|
| Modifier and Type | Method and Description |
|---|---|
<U> EagerFutureStream<U> |
construct(java.util.stream.Stream s,
java.util.concurrent.ExecutorService executor,
com.nurkiewicz.asyncretry.RetryExecutor retrier,
boolean eager) |
<U> EagerFutureStream<U> |
fromStream(java.util.stream.Stream<java.util.concurrent.CompletableFuture<U>> stream)
Start a reactive dataflow from a stream of CompletableFutures.
|
<U> EagerFutureStream<U> |
fromStreamWithoutFutures(java.util.stream.Stream<U> stream)
Start a reactive dataflow from a stream.
|
<U> EagerFutureStream<U> |
of(U... array) |
<U> EagerFutureStream<U> |
react(java.util.function.Function<U,U> f,
ReactIterator<U> t)
Start an EagerFutureStream that calls the supplied function iteratively, with each output, feeding into the next input
Example :-
List<Integer> results = new EagerReact()
.<Integer> react((input) -> input + 1,iterate(0).times(1).offset(10))
|
<U> EagerFutureStream<U> |
react(java.util.Iterator<U> iterator,
int maxTimes)
Start a LazyFutureStream from a JDK Iterator
|
<U> EagerFutureStream<U> |
react(java.util.List<java.util.function.Supplier<U>> actions)
Start a reactive dataflow with a list of one-off-suppliers
|
<U> EagerFutureStream<U> |
react(java.util.function.Supplier<U> s,
Generator t)
Start a EagerFutureStream from a single Supplier, which will be executed repeatedly according to rules defined by the generator.
|
<R> EagerFutureStream<R> |
reactToCollection(java.util.Collection<R> collection)
Start a EagerFutureStream from a Collection
|
getExecutor, getRetrier, isEager, iterate, iterateInfinitely, react, reactI, reactInfinitely, times, timesInSequencepublic EagerReact()
ThreadPools.getStandard()public EagerReact(java.util.concurrent.ExecutorService executor)
executor - ExecutorService to usepublic <U> EagerFutureStream<U> construct(java.util.stream.Stream s, java.util.concurrent.ExecutorService executor, com.nurkiewicz.asyncretry.RetryExecutor retrier, boolean eager)
construct in class BaseSimpleReactpublic <U> EagerFutureStream<U> fromStream(java.util.stream.Stream<java.util.concurrent.CompletableFuture<U>> stream)
BaseSimpleReactfromStream in class BaseSimpleReactstream - of CompletableFutures that will be used to drive the reactive dataflowpublic <U> EagerFutureStream<U> fromStreamWithoutFutures(java.util.stream.Stream<U> stream)
BaseSimpleReactfromStreamWithoutFutures in class BaseSimpleReactstream - that will be used to drive the reactive dataflowpublic <U> EagerFutureStream<U> of(U... array)
of in class BaseSimpleReactpublic <U> EagerFutureStream<U> react(java.util.List<java.util.function.Supplier<U>> actions)
BaseSimpleReactreact in class BaseSimpleReactactions - List of Suppliers to provide data (and thus events) that
downstream jobs will react toopublic <U> EagerFutureStream<U> react(java.util.Iterator<U> iterator, int maxTimes)
react in class BaseSimpleReactiterator - SimpleReact will iterate over this iterator concurrently to start the reactive dataflowmaxTimes - Maximum number of iterationspublic <R> EagerFutureStream<R> reactToCollection(java.util.Collection<R> collection)
reactToCollection in class BaseSimpleReactcollection - - Collection Stream will be formed frompublic <U> EagerFutureStream<U> react(java.util.function.Supplier<U> s, Generator t)
List<String> strings = new EagerReact()
.<Integer> react(() -> count++ ,EagerReact.times(4))
To skip the first 5 iterations and take the next 5
*
List<String> strings = new EagerReact()
.<Integer> react(() -> count++ ,EagerReact.times(5).offset(5))
The supplier will be called 10 times, in the above example, but only the last 5 results will be passed into the
reactive dataflow.react in class BaseSimpleReacts - Supplier to provide data (and thus events) that
downstream jobs will react toot - Generator implementation that will determine how the Supplier is executedpublic <U> EagerFutureStream<U> react(java.util.function.Function<U,U> f, ReactIterator<U> t)
List<Integer> results = new EagerReact()
.<Integer> react((input) -> input + 1,iterate(0).times(1).offset(10))
react in class BaseSimpleReactf - Function to be called iterativelyt - Iterator that manages function call