REACTOR
- x-react builder type (SimpleReact, EagerReact, LazyReact)public class ReactPool<REACTOR extends ReactBuilder>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <REACTOR extends ReactBuilder> |
boundedPool(java.util.Collection<REACTOR> reactors)
If all REACTORs are in use calling react will block.
|
static <REACTOR extends ReactBuilder> |
elasticPool(java.util.function.Supplier<REACTOR> supplier)
If all REACTORs are in use calling react will create a new REACTOR to handle the extra demand.
|
REACTOR |
nextReactor() |
void |
populate(REACTOR next) |
<T> T |
react(java.util.function.Function<REACTOR,T> fn) |
static <REACTOR extends ReactBuilder> |
syncrhonousPool() |
static <REACTOR extends ReactBuilder> |
unboundedPool(java.util.Collection<REACTOR> reactors)
If all REACTORs are in use calling react will block.
|
public static <REACTOR extends ReactBuilder> ReactPool<REACTOR> boundedPool(java.util.Collection<REACTOR> reactors)
reactors
- Create a bounded pool of the specified REACTORspublic static <REACTOR extends ReactBuilder> ReactPool<REACTOR> unboundedPool(java.util.Collection<REACTOR> reactors)
reactors
- Create a unbounded pool of the specified REACTORs, additional REACTORs can be added via populatepublic static <REACTOR extends ReactBuilder> ReactPool<REACTOR> elasticPool(java.util.function.Supplier<REACTOR> supplier)
supplier
- To create new REACTORspublic static <REACTOR extends ReactBuilder> ReactPool<REACTOR> syncrhonousPool()
public void populate(REACTOR next)
next
- REACTOR to add to the Poolpublic <T> T react(java.util.function.Function<REACTOR,T> fn)
fn
- Function that operates on a REACTOR - typically will build an execute a Stream using that REACTOR.
This method will extract and return the REACTOR to the pool.public REACTOR nextReactor()