public class LazyReact extends BaseLazySimpleReact
Constructor and Description |
---|
LazyReact()
Construct a LazyReact builder using standard thread pool.
|
LazyReact(java.util.concurrent.Executor executor)
Construct a LazyReact builder with provided Executor
|
LazyReact(java.util.concurrent.Executor executor,
com.nurkiewicz.asyncretry.RetryExecutor retrier,
java.lang.Boolean async,
MaxActive maxActive) |
LazyReact(int threadPoolSize,
int concurrency)
LazyReact builder with a new TaskExecutor with threads determined by threadPoolSize
Max concurrent tasks is determined by concurrency
|
Modifier and Type | Method and Description |
---|---|
<U> LazyFutureStream<U> |
construct(java.util.stream.Stream s,
java.util.List<java.util.concurrent.CompletableFuture> org) |
<U> LazyFutureStream<U> |
fromStream(java.util.stream.Stream<java.util.concurrent.CompletableFuture<U>> stream)
Start a reactive dataflow from a stream of CompletableFutures.
|
boolean |
isAsync() |
<U> LazyFutureStream<U> |
iterateInfinitely(U seed,
java.util.function.UnaryOperator<U> f)
Iterate infinitely using the supplied seed and function
|
<R> LazyFutureStream<R> |
of(java.util.Collection<R> collection)
Start a LazyFutureStream from a Collection
|
LazyFutureStream<java.lang.Double> |
of(java.util.stream.DoubleStream stream)
Start a reactive dataflow from a stream.
|
LazyFutureStream<java.lang.Integer> |
of(java.util.stream.IntStream stream)
Start a reactive dataflow from a stream.
|
<U> LazyFutureStream<U> |
of(java.util.Iterator<U> iterator)
Start a LazyFutureStream from a JDK Iterator
|
LazyFutureStream<java.lang.Long> |
of(java.util.stream.LongStream stream)
Start a reactive dataflow from a stream.
|
<U> LazyFutureStream<U> |
of(java.util.stream.Stream<U> stream)
Start a reactive dataflow from a stream.
|
<U> LazyFutureStream<U> |
of(U... array) |
<U> LazyFutureStream<U> |
ofIterable(java.lang.Iterable<U> iter)
Start a reactive flow from a JDK Iterator
|
LazyFutureStream<java.lang.Integer> |
range(int startInclusive,
int endExclusive) |
<U> LazyFutureStream<U> |
react(java.util.Collection<java.util.function.Supplier<U>> actions)
Start a reactive dataflow with a list of one-off-suppliers
|
<U> LazyFutureStream<U> |
react(java.util.Iterator<java.util.function.Supplier<U>> actions)
Start a reactive dataflow with a list of one-off-suppliers
|
<U> LazyFutureStream<U> |
react(java.util.stream.Stream<java.util.function.Supplier<U>> actions)
Start a reactive dataflow with a list of one-off-suppliers
|
<U> LazyFutureStream<U> |
react(java.util.function.Supplier<U>... actions)
Start a reactive dataflow with an array of one-off-suppliers
|
protected <U> LazyFutureStream<U> |
reactI(java.util.function.Supplier<U>... actions)
This internal method has been left protected, so it can be mocked / stubbed as some of the entry points are final
|
<U> LazyFutureStream<U> |
reactInfinitely(java.util.function.Supplier<U> s)
Generate an infinite LazyFutureStream
The flow will run indefinitely unless / until the provided Supplier throws an Exception
|
<U> LazyFutureStream<U> |
reactInfinitelyAsync(java.util.function.Supplier<U> s)
Generate an infinite reactive flow.
|
<U> LazyFutureStream<U> |
reactIterable(java.lang.Iterable<java.util.function.Supplier<U>> actions)
Start a reactive dataflow with a list of one-off-suppliers
|
getExecutor, getRetrier
public LazyReact()
ThreadPools.getStandard()
public LazyReact(java.util.concurrent.Executor executor)
executor
- Executor to usepublic LazyReact(int threadPoolSize, int concurrency)
threadPoolSize
- concurrency
- public LazyReact(java.util.concurrent.Executor executor, com.nurkiewicz.asyncretry.RetryExecutor retrier, java.lang.Boolean async, MaxActive maxActive)
executor
- Task Executor for concurrent tasksretrier
- Async Retrierasync
- If true each task will be submitted to an executor servicepublic boolean isAsync()
isAsync
in class BaseSimpleReact
public <U> LazyFutureStream<U> construct(java.util.stream.Stream s, java.util.List<java.util.concurrent.CompletableFuture> org)
construct
in class BaseSimpleReact
public LazyFutureStream<java.lang.Integer> range(int startInclusive, int endExclusive)
range
in class BaseSimpleReact
public <U> LazyFutureStream<U> fromStream(java.util.stream.Stream<java.util.concurrent.CompletableFuture<U>> stream)
BaseSimpleReact
fromStream
in class BaseSimpleReact
stream
- of CompletableFutures that will be used to drive the reactive dataflow@SafeVarargs public final <U> LazyFutureStream<U> react(java.util.function.Supplier<U>... actions)
BaseSimpleReact
react
in class BaseSimpleReact
actions
- Array of Suppliers to provide data (and thus events) that
downstream jobs will react toopublic <U> LazyFutureStream<U> of(java.util.stream.Stream<U> stream)
BaseSimpleReact
of
in class BaseSimpleReact
stream
- that will be used to drive the reactive dataflowpublic LazyFutureStream<java.lang.Integer> of(java.util.stream.IntStream stream)
BaseSimpleReact
of
in class BaseSimpleReact
stream
- that will be used to drive the reactive dataflowpublic LazyFutureStream<java.lang.Double> of(java.util.stream.DoubleStream stream)
BaseSimpleReact
of
in class BaseSimpleReact
stream
- that will be used to drive the reactive dataflowpublic LazyFutureStream<java.lang.Long> of(java.util.stream.LongStream stream)
BaseSimpleReact
of
in class BaseSimpleReact
stream
- that will be used to drive the reactive dataflowpublic <U> LazyFutureStream<U> of(U... array)
of
in class BaseSimpleReact
public <U> LazyFutureStream<U> react(java.util.Collection<java.util.function.Supplier<U>> actions)
BaseSimpleReact
react
in class BaseSimpleReact
actions
- List of Suppliers to provide data (and thus events) that
downstream jobs will react toopublic <U> LazyFutureStream<U> of(java.util.Iterator<U> iterator)
of
in class BaseSimpleReact
iterator
- SimpleReact will iterate over this iterator concurrently to start the reactive dataflowpublic <R> LazyFutureStream<R> of(java.util.Collection<R> collection)
of
in class BaseSimpleReact
collection
- - Collection Stream will be formed frompublic <U> LazyFutureStream<U> reactInfinitely(java.util.function.Supplier<U> s)
reactInfinitely
in class BaseLazySimpleReact
s
- Supplier to generate the infinite flowSimpleReact Queue for a way to create a more managable infinit flow
public <U> LazyFutureStream<U> reactInfinitelyAsync(java.util.function.Supplier<U> s)
reactInfinitelyAsync
in class BaseLazySimpleReact
s
- Supplier to generate the infinite flowSimpleReact Queue for a way to create a more managable infinit flow
public <U> LazyFutureStream<U> iterateInfinitely(U seed, java.util.function.UnaryOperator<U> f)
BaseLazySimpleReact
iterateInfinitely
in class BaseLazySimpleReact
seed
- Initial valuef
- Function that performs the iterationprotected <U> LazyFutureStream<U> reactI(java.util.function.Supplier<U>... actions)
BaseSimpleReact
reactI
in class BaseSimpleReact
public <U> LazyFutureStream<U> ofIterable(java.lang.Iterable<U> iter)
BaseSimpleReact
ofIterable
in class BaseSimpleReact
iter
- SimpleReact will iterate over this iterator concurrently to start the reactive dataflowpublic <U> LazyFutureStream<U> react(java.util.stream.Stream<java.util.function.Supplier<U>> actions)
BaseSimpleReact
react
in class BaseSimpleReact
actions
- Stream of Suppliers to provide data (and thus events) that
downstream jobs will react toopublic <U> LazyFutureStream<U> react(java.util.Iterator<java.util.function.Supplier<U>> actions)
BaseSimpleReact
react
in class BaseSimpleReact
actions
- Iterator over Suppliers to provide data (and thus events) that
downstream jobs will react toopublic <U> LazyFutureStream<U> reactIterable(java.lang.Iterable<java.util.function.Supplier<U>> actions)
BaseSimpleReact
reactIterable
in class BaseSimpleReact
actions
- Stream of Suppliers to provide data (and thus events) that
downstream jobs will react too