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
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanwaitFor(long durationMillis, long sleepMillis, Wait.Condition condition)Same aswaitFor(long, Condition).static booleanwaitFor(long durationMillis, Wait.Condition condition)Waits for a condition to be satisfied or tilldurationMillis, whichever is sooner.static booleanwaitFor(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.
-