Package org.javalite.common
Class Wait
- java.lang.Object
-
- org.javalite.common.Wait
-
public class Wait extends Object
Borrowed from Apache Artemis. Can wait for a condition.
Example of usage:Wait.waitFor(() -> messageService.getMessageCount() == 1);Defaults:
- MAX_WAIT_MILLIS = 30 * 1000
- SLEEP_MILLIS = 100
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceWait.Condition
-
Constructor Summary
Constructors Constructor Description Wait()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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)
-
-
-
Method Detail
-
waitFor
public static boolean waitFor(Wait.Condition condition)
Same aswaitFor(long, long, Condition)- Parameters:
condition- condition to check from time to time;- Returns:
- true if condition was satisfied, false if not.
-
waitFor
public static boolean waitFor(long durationMillis, Wait.Condition condition)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
public static boolean waitFor(long durationMillis, long sleepMillis, Wait.Condition condition)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.
-
-