Package reactor.test.util
Class RaceTestUtils
java.lang.Object
reactor.test.util.RaceTestUtils
- Author:
- Stephane Maldini, David Karnok
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidSynchronizes the execution of severalRunnables as much as possible to test race conditions.static voidSynchronizes the execution of severalRunnables as much as possible to test race conditions.static voidSynchronizes the execution of twoRunnables as much as possible to test race conditions.static voidDeprecated.static voidSynchronizes the execution of severalRunnables as much as possible to test race conditions.static <T> booleanrace(T initial, Function<? super T, ? extends T> race, Predicate<? super T> stopRace, BiPredicate<? super T, ? super T> terminate) Synchronizes the execution of two concurrent state modifications as much as possible to test race conditions.
-
Constructor Details
-
RaceTestUtils
public RaceTestUtils()
-
-
Method Details
-
race
public static <T> boolean race(T initial, Function<? super T, ? extends T> race, Predicate<? super T> stopRace, BiPredicate<? super T, ? super T> terminate) Synchronizes the execution of two concurrent state modifications as much as possible to test race conditions. The method blocks until the givenPredicatematches. It performs aBiPredicatetest at the end to validate the end result.- Parameters:
initial- the initial staterace- the state-modificationFunctionstopRace- the stop condition for the race loop, as aPredicateterminate- the validation check, as aBiPredicate- Returns:
- the result of the
terminatecheck
-
race
Synchronizes the execution of severalRunnables as much as possible to test race conditions. The method blocks until all have run to completion.- Parameters:
rs- the runnables to execute
-
race
Synchronizes the execution of twoRunnables as much as possible to test race conditions. The method blocks until both have run to completion. Kept for binary compatibility, see the varargs variant.- Parameters:
r1- the first runnable to executer2- the second runnable to execute- See Also:
-
race
Deprecated.Userace(Scheduler, Runnable...). To be removed in 3.6.0, at the earliest.Synchronizes the execution of twoRunnableas much as possible to test race conditions. The method blocks until both have run to completion.- Parameters:
s- theScheduleron which to execute the runnablesr1- the first runnabler2- the second runnable
-
race
Synchronizes the execution of severalRunnables as much as possible to test race conditions. The method blocks until all have run to completion, with a 5s timeout.- Parameters:
s- theScheduleron which to execute the runnablesrs- the runnables to execute
-
race
Synchronizes the execution of severalRunnables as much as possible to test race conditions. The method blocks until all have run to completion, with a configurable timeout (allowing for debugging sessions to use a larger timeout).- Parameters:
timeoutSeconds- the number of seconds after which the race is considered timed out. intended for debugging purposes.s- theScheduleron which to execute the runnablesrs- the runnables to execute
-
race(Scheduler, Runnable...).