Package org.javalite.common
Class Wait
java.lang.Object
org.javalite.common.Wait
Borrowed from Apache Artemis. Can wait for a condition.
Example of usage:
MAX_WAIT_MILLIS = 30 * 1000
SLEEP_MILLIS = 100
Example of usage:
Wait.waitFor(() -> messageService.getMessageCount() == 1);
Defaults:
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
waitFor(long durationMillis, long sleepMillis, Wait.Condition condition)
Same aswaitFor(long, Condition)
.static boolean
waitFor(long durationMillis, Wait.Condition condition)
Waits for a condition to be satisfied or tilldurationMillis
, whichever is sooner.static boolean
waitFor(Wait.Condition condition)
Same aswaitFor(long, long, Condition)
-
Constructor Details
-
Wait
public Wait()
-
-
Method Details
-
waitFor
Same aswaitFor(long, long, Condition)
- Parameters:
condition
- condition to check from time to time;- Returns:
- true if condition was satisfied, false if not.
-
waitFor
Waits for a condition to be satisfied or tilldurationMillis
, whichever is sooner.- Parameters:
durationMillis
- max time to wait in millis.condition
- condition to check from time to time;- Returns:
- true if condition was satisfied, false if not.
-
waitFor
Same aswaitFor(long, Condition)
.- Parameters:
sleepMillis
- time to sleep between checks.durationMillis
- max time to wait in millis.condition
- condition to check from time to time;- Returns:
- true if condition was satisfied, false if not.
-