|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.cdi.tck.util.Timer
public class Timer
Delays thread execution for specified time or unless stop conditions are satisfied according to actual
resolutionLogic.
Setting the sleep interval to value less than 15 ms is questionable since some operating systems do not provide such precision. Moreover such values may impact test performance.
In case of no stop conditions are specified, timer logic corresponds to regular Thread.sleep(long) execution.
| Nested Class Summary | |
|---|---|
static class |
Timer.ResolutionLogic
|
static interface |
Timer.StopCondition
|
| Constructor Summary | |
|---|---|
Timer()
Create new timer with default delay and sleep interval. |
|
| Method Summary | |
|---|---|
Timer |
addStopCondition(Timer.StopCondition condition)
Add new stop condition. |
Timer |
addStopCondition(Timer.StopCondition condition,
boolean clear)
Add new stop condition. |
void |
clearStopConditions()
Clear stop conditions and reset stopConditionsSatisfiedBeforeTimeout. |
boolean |
isStopConditionsSatisfiedBeforeTimeout()
|
void |
reset()
Reset to default values. |
Timer |
setDelay(long delay)
Set new delay value. |
Timer |
setResolutionLogic(Timer.ResolutionLogic resolutionLogic)
Set new resolution logic. |
Timer |
setSleepInterval(long sleepInterval)
Set new sleep interval value. |
Timer |
start()
Start the timer. |
static Timer |
startNew(long delay)
Start a new timer with specified delay. |
static Timer |
startNew(long delay,
long sleepInterval)
Start a new timer with specified delay and sleep interval. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Timer()
delay - | Method Detail |
|---|
public Timer setDelay(long delay)
delay -
public Timer setSleepInterval(long sleepInterval)
sleepInterval -
public Timer setResolutionLogic(Timer.ResolutionLogic resolutionLogic)
resolutionLogic -
public Timer addStopCondition(Timer.StopCondition condition)
condition -
public Timer addStopCondition(Timer.StopCondition condition,
boolean clear)
condition - clear - Clear stop conditions and reset stopConditionsSatisfiedBeforeTimeout
public Timer start()
throws InterruptedException
InterruptedExceptionpublic void reset()
public void clearStopConditions()
stopConditionsSatisfiedBeforeTimeout.
public boolean isStopConditionsSatisfiedBeforeTimeout()
true if stop conditions are satisfied according to actual resolutionLogic before timeout
occurs, false otherwise
public static Timer startNew(long delay)
throws InterruptedException
delay -
InterruptedException
public static Timer startNew(long delay,
long sleepInterval)
throws InterruptedException
delay -
InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||