Package io.helidon.common.reactive.valve
Class Valves
- java.lang.Object
-
- io.helidon.common.reactive.valve.Valves
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Valve<T>
empty()
Returns an emptyValve
- instance, which report complete as soon as handler is registered.static <T> Valve<T>
from(Flow.Publisher<T> publisher)
Creates aValve
instance from providedFlow.Publisher
.static Valve<ByteBuffer>
from(InputStream stream, int bufferCapacity)
static Valve<ByteBuffer>
from(InputStream stream, int bufferCapacity, ExecutorService executorService)
static <T> Valve<T>
from(Iterable<T> iterable)
static <T> Valve<T>
from(T... t)
Creates aValve
instance from provided array.
-
-
-
Method Detail
-
from
@SafeVarargs public static <T> Valve<T> from(T... t)
Creates aValve
instance from provided array.If
t array
parameter isnull
then returns an emptyValve
.- Type Parameters:
T
- a type of the array items- Parameters:
t
- an array to provide as aValve
- Returns:
- the new instance
-
from
public static <T> Valve<T> from(Iterable<T> iterable)
Creates aValve
instance from the providedIterable
.If
iterable
parameter isnull
then returns an emptyValve
.- Type Parameters:
T
- a type of iterable items- Parameters:
iterable
- an iterable to provide as aValve
- Returns:
- the new instance
-
from
public static Valve<ByteBuffer> from(InputStream stream, int bufferCapacity)
Creates aByteBuffer
basedValve
instance from the providedInputStream
. Each byte buffer will have the provided capacity.Each byte buffer uses a newly allocated memory and as such no pooling is performed.
- Parameters:
stream
- the input stream to create theValve
frombufferCapacity
- the capacity of each buffer of bytes- Returns:
- the new instance
-
from
public static Valve<ByteBuffer> from(InputStream stream, int bufferCapacity, ExecutorService executorService)
Creates aByteBuffer
basedValve
instance from the providedInputStream
. Each byte buffer will have the provided capacity.Each byte buffer uses a newly allocated memory and as such no pooling is performed.
- Parameters:
stream
- the input stream to create theValve
frombufferCapacity
- the capacity of each buffer of bytesexecutorService
- the executor service to use for an execution of theInputStream.read()
(and its overloads) operations that are blocking by its nature.- Returns:
- the new instance
-
from
public static <T> Valve<T> from(Flow.Publisher<T> publisher)
Creates aValve
instance from providedFlow.Publisher
.If
publisher
parameter isnull
then returns an emptyValve
.- Type Parameters:
T
- a type of published items- Parameters:
publisher
- a publisher to provide as aValve
- Returns:
- the new instance
-
empty
public static <T> Valve<T> empty()
Returns an emptyValve
- instance, which report complete as soon as handler is registered.For performance reason, this particular Valve accepts any amount of handlers.
- Type Parameters:
T
- type of the item (which is not there :-) )- Returns:
- singleton instance
-
-