Package com.github.sonus21.rqueue.utils
Class TimeoutUtils
- java.lang.Object
-
- com.github.sonus21.rqueue.utils.TimeoutUtils
-
public final class TimeoutUtils extends java.lang.Object
WaitForUtil 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.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
sleep(long time)
static void
sleepLog(long time, boolean log)
static void
waitFor(java.util.function.BooleanSupplier callback, long waitTimeInMilliSeconds, java.lang.String description)
static void
waitFor(java.util.function.BooleanSupplier callback, long waitTimeInMilliSeconds, java.lang.String description, java.lang.Runnable postmortem)
static void
waitFor(java.util.function.BooleanSupplier callback, java.lang.String description)
static void
waitFor(java.util.function.BooleanSupplier callback, java.lang.String description, java.lang.Runnable postmortem)
-
-
-
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)
-
-