Package com.github.sonus21.rqueue.utils
Class TimeoutUtils
- java.lang.Object
-
- com.github.sonus21.rqueue.utils.TimeoutUtils
-
public final class TimeoutUtils extends java.lang.ObjectwaitFor 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 Modifier and Type Field Description static longEXECUTION_TIMEstatic longSLEEP_TIME
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidsleep(long time)static voidsleepLog(long time, boolean log)static voidwaitFor(java.util.function.BooleanSupplier callback, long waitTimeInMilliSeconds, java.lang.String description)static voidwaitFor(java.util.function.BooleanSupplier callback, long waitTimeInMilliSeconds, java.lang.String description, java.lang.Runnable postmortem)static voidwaitFor(java.util.function.BooleanSupplier callback, java.lang.String description)static voidwaitFor(java.util.function.BooleanSupplier callback, java.lang.String description, java.lang.Runnable postmortem)
-
-
-
Field Detail
-
EXECUTION_TIME
public static final long EXECUTION_TIME
- See Also:
- Constant Field Values
-
SLEEP_TIME
public static final long SLEEP_TIME
- See Also:
- Constant Field Values
-
-
Method Detail
-
waitFor
public static void waitFor(java.util.function.BooleanSupplier callback, long waitTimeInMilliSeconds, java.lang.String description) throws TimedOutException- Throws:
TimedOutException
-
waitFor
public static void waitFor(java.util.function.BooleanSupplier callback, java.lang.String description) throws TimedOutException- Throws:
TimedOutException
-
waitFor
public static void waitFor(java.util.function.BooleanSupplier callback, java.lang.String description, java.lang.Runnable postmortem) throws TimedOutException- Throws:
TimedOutException
-
waitFor
public static void waitFor(java.util.function.BooleanSupplier callback, long waitTimeInMilliSeconds, java.lang.String description, java.lang.Runnable postmortem) throws TimedOutException- Throws:
TimedOutException
-
sleep
public static void sleep(long time)
-
sleepLog
public static void sleepLog(long time, boolean log)
-
-