public abstract class ConditionalSleep
extends java.lang.Object
Constructor and Description |
---|
ConditionalSleep(int timeout)
Creates a ConditionalSleep instance that will sleep until its condition is true or
if the timeout has expired.
|
ConditionalSleep(int timeout,
int sleepTime)
Creates a ConditionalSleep instance that will sleep until its condition is true or
if the timeout has expired.
|
ConditionalSleep(int timeout,
int sleepTime,
int sleepDeviation)
Creates a ConditionalSleep instance that will sleep until its condition is true or
if the timeout has expired.
|
ConditionalSleep(java.lang.Runnable sleepTask,
int timeout)
Creates a ConditionalSleep instance that will sleep until its condition is true or
if the timeout has expired.
|
ConditionalSleep(java.lang.Runnable sleepTask,
int timeout,
int sleepTime)
Creates a ConditionalSleep instance that will sleep until its condition is true or
if the timeout has expired.
|
ConditionalSleep(java.lang.Runnable sleepTask,
int timeout,
int sleepTime,
int sleepDeviation)
Creates a ConditionalSleep instance that will sleep until its condition is true or
if the timeout has expired.
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
condition() |
boolean |
sleep()
Sleeps for as long the specified condition is not true or the timeout has expired.
|
public ConditionalSleep(int timeout)
timeout
- The specified time out.public ConditionalSleep(java.lang.Runnable sleepTask, int timeout)
sleepTask
- The task to perform whilst sleeping.timeout
- The specified time out.public ConditionalSleep(int timeout, int sleepTime)
timeout
- The specified time out.sleepTime
- The time to sleep in milliseconds between timeout and conditions checks.public ConditionalSleep(int timeout, int sleepTime, int sleepDeviation)
timeout
- The specified time out.sleepTime
- The time to sleep in milliseconds between timeout and conditions checks.sleepDeviation
- The normal distribution upper bound and deviation for the sleepTime.public ConditionalSleep(java.lang.Runnable sleepTask, int timeout, int sleepTime)
sleepTask
- The task to perform whilst sleeping.timeout
- The specified time out.sleepTime
- The time to sleep in milliseconds between timeout and conditions checks.public ConditionalSleep(java.lang.Runnable sleepTask, int timeout, int sleepTime, int sleepDeviation)
sleepTask
- The task to perform whilst sleeping.timeout
- The specified time out.sleepTime
- The time to sleep in milliseconds between timeout and conditions checks.sleepDeviation
- The normal distribution upper bound and deviation for the sleepTime.public abstract boolean condition() throws java.lang.InterruptedException
java.lang.InterruptedException
public final boolean sleep()