public class ConcurrencyUtils extends Object
Provides utility methods related to concurrency.
| Modifier and Type | Method and Description |
|---|---|
static void |
awaitCondition(Operation<Boolean> condition,
long maxWaitTimeMillis,
long intervalMillis,
String errorMessage)
Waits a given amount of time for a certain condition to become true.
|
static void |
sleep(long duration,
TimeUnit timeUnit)
Sleeps the given amount of time.
|
public static void awaitCondition(Operation<Boolean> condition, long maxWaitTimeMillis, long intervalMillis, String errorMessage)
Waits a given amount of time for a certain condition to become true. The condition is checked for in the given interval.
condition - the condition to wait for to become truemaxWaitTimeMillis - the maximum amount of time to wait for the condition to become trueintervalMillis - the amount of time to wait between checking for the condition to become trueerrorMessage - the error message of the exception thrown when the condition does not become trueIllegalStateException - thrown if the condition does not become true in the given maximum amount of timepublic static void sleep(long duration,
TimeUnit timeUnit)
Sleeps the given amount of time.
duration - the duration to sleeptimeUnit - the time unit of the duration to sleepCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.