- java.lang.Object
-
- io.helidon.common.reactive.StreamValidationUtils
-
public class StreamValidationUtils extends Object
Helper methods for stream validation.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> booleancheckRecursionDepth(int maxDepth, BiConsumer<Long,Throwable> onExceeded)Validation of Reactive Streams Specification for JVM rule 3.3.static booleancheckRequestParam(long requestParam, Consumer<? super IllegalArgumentException> onExceeded)Validation of Reactive Streams Specification for JVM rule 3.9.
-
-
-
Method Detail
-
checkRecursionDepth
public static <T> boolean checkRecursionDepth(int maxDepth, BiConsumer<Long,Throwable> onExceeded)Validation of Reactive Streams Specification for JVM rule 3.3.
Subscription.requestMUST place an upper bound on possible synchronous recursion betweenPublisherandSubscriber.- Type Parameters:
T- payload type of the subscriber- Parameters:
maxDepth- maximal expected recursion depthonExceeded- called if recursion is deeper than maxDepth, provided with actual depth and spec compliant exception.- Returns:
- true if valid
- See Also:
- reactive-streams/reactive-streams-jvm#3.3
-
checkRequestParam
public static boolean checkRequestParam(long requestParam, Consumer<? super IllegalArgumentException> onExceeded)Validation of Reactive Streams Specification for JVM rule 3.9.
While theSubscriptionis not cancelled,Subscription.request(long n)MUST signal onError with aIllegalArgumentExceptionif the argument is less or equal to 0. The cause message SHOULD explain that non-positive request signals are illegal.- Parameters:
requestParam- number of requested items to be validated.onExceeded- called if request param invalid provided with spec compliant exception.- Returns:
- true if requested parameter is valid
- See Also:
- reactive-streams/reactive-streams-jvm#3.9
-
-