public class RaceTestUtils
extends java.lang.Object
| Constructor and Description |
|---|
RaceTestUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
race(int timeoutSeconds,
Scheduler s,
java.lang.Runnable... rs)
Synchronizes the execution of several
Runnables as much as possible
to test race conditions. |
static void |
race(java.lang.Runnable... rs)
Synchronizes the execution of several
Runnables as much as possible
to test race conditions. |
static void |
race(java.lang.Runnable r1,
java.lang.Runnable r2)
Synchronizes the execution of two
Runnables as much as possible
to test race conditions. |
static void |
race(java.lang.Runnable r1,
java.lang.Runnable r2,
Scheduler s)
Deprecated.
Use
race(Scheduler, Runnable...). To be removed in 3.6.0, at the earliest. |
static void |
race(Scheduler s,
java.lang.Runnable... rs)
Synchronizes the execution of several
Runnables as much as possible
to test race conditions. |
static <T> boolean |
race(T initial,
java.util.function.Function<? super T,? extends T> race,
java.util.function.Predicate<? super T> stopRace,
java.util.function.BiPredicate<? super T,? super T> terminate)
Synchronizes the execution of two concurrent state modifications as much as
possible to test race conditions.
|
public static <T> boolean race(T initial,
java.util.function.Function<? super T,? extends T> race,
java.util.function.Predicate<? super T> stopRace,
java.util.function.BiPredicate<? super T,? super T> terminate)
Predicate
matches. It performs a BiPredicate test at the end to validate the end
result.initial - the initial staterace - the state-modification FunctionstopRace - the stop condition for the race loop, as a Predicateterminate - the validation check, as a BiPredicateterminate checkpublic static void race(java.lang.Runnable... rs)
Runnables as much as possible
to test race conditions. The method blocks until all have run to completion.rs - the runnables to executepublic static void race(java.lang.Runnable r1,
java.lang.Runnable r2)
Runnables 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.r1 - the first runnable to executer2 - the second runnable to executerace(Runnable...)@Deprecated
public static void race(java.lang.Runnable r1,
java.lang.Runnable r2,
Scheduler s)
race(Scheduler, Runnable...). To be removed in 3.6.0, at the earliest.Runnable as much as possible
to test race conditions. The method blocks until both have run to completion.s - the Scheduler on which to execute the runnablesr1 - the first runnabler2 - the second runnablepublic static void race(Scheduler s, java.lang.Runnable... rs)
Runnables as much as possible
to test race conditions. The method blocks until all have run to completion,
with a 5s timeout.s - the Scheduler on which to execute the runnablesrs - the runnables to executepublic static void race(int timeoutSeconds,
Scheduler s,
java.lang.Runnable... rs)
Runnables 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).timeoutSeconds - the number of seconds after which the race is considered timed out. intended for debugging purposes.s - the Scheduler on which to execute the runnablesrs - the runnables to execute