Package com.github.sonus21.rqueue.utils
Class TimeoutUtils
java.lang.Object
com.github.sonus21.rqueue.utils.TimeoutUtils
waitFor method wait for some event to occur. It accepts a callback as well that can be invoked on
successive failure of the method. That can be used to diagnosis the test. A callback method is
used to identify the outcome of some event, if the specified method returns true then call is
stopped otherwise every 100Ms the callback would be called to get the outcome. It tries for
continuously over 10seconds If callback does not return true within 10 seconds then it will throw
TimeOutException. If postmortem method is provided then it will call that method before throwing
exception.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidsleep(long time) static voidsleepLog(long time, boolean log) static voidwaitFor(BooleanSupplier callback, long waitTimeInMilliSeconds, long sleepDuration, String description, Runnable postmortem) static voidwaitFor(BooleanSupplier callback, long waitTimeInMilliSeconds, String description) static voidwaitFor(BooleanSupplier callback, long waitTimeInMilliSeconds, String description, Runnable postmortem) static voidwaitFor(BooleanSupplier callback, String description) static voidwaitFor(BooleanSupplier callback, String description, Runnable postmortem)
-
Field Details
-
EXECUTION_TIME
public static final long EXECUTION_TIME- See Also:
-
SLEEP_TIME
public static final long SLEEP_TIME- See Also:
-
-
Method Details
-
waitFor
public static void waitFor(BooleanSupplier callback, long waitTimeInMilliSeconds, String description) throws TimedOutException - Throws:
TimedOutException
-
waitFor
- Throws:
TimedOutException
-
waitFor
public static void waitFor(BooleanSupplier callback, String description, Runnable postmortem) throws TimedOutException - Throws:
TimedOutException
-
waitFor
public static void waitFor(BooleanSupplier callback, long waitTimeInMilliSeconds, String description, Runnable postmortem) throws TimedOutException - Throws:
TimedOutException
-
waitFor
public static void waitFor(BooleanSupplier callback, long waitTimeInMilliSeconds, long sleepDuration, String description, Runnable postmortem) throws TimedOutException - Throws:
TimedOutException
-
sleep
public static void sleep(long time) -
sleepLog
public static void sleepLog(long time, boolean log)
-