| Modifier and Type | Class and Description |
|---|---|
class |
SafeTimerMock.ScheduledTask
This holds all our tasks for the timer mock
|
| Modifier and Type | Field and Description |
|---|---|
java.util.List<SafeTimerMock.ScheduledTask> |
scheduled
This is the list of all ScheduledTasks on this SafeTimerMock
|
| Constructor and Description |
|---|
SafeTimerMock() |
| Modifier and Type | Method and Description |
|---|---|
static void |
advanceTime(long millis)
This moves time forward in the mock timer, which will trigger any timers that need to be triggered in a synchronous
manner on this thread.
|
void |
cancel()
Cancel this timer.
|
long |
now()
This retrieves the current time on this box.
|
int |
numTasksScheduled()
This returns the number of tasks we currently have scheduled on this SafeTimerMock.
|
static void |
resetMockTime()
This clears any previous timers we still had registered, and gets the system ready to restart
|
void |
schedule(SafeTimerTask task,
long delay) |
void |
schedule(SafeTimerTask task,
long delay,
long period) |
void |
scheduleAtFixedRate(SafeTimerTask task,
long period)
Schedule at a fixed rate with no delay.
|
void |
scheduleAtFixedRate(SafeTimerTask task,
long delay,
long period) |
static long |
time()
Get the current time on the timer mock.
|
void |
waitForSilence()
This blocks the calling thread until there are no outstanding tasks on this SafeTimerMock running, then continues.
|
void |
withTimerLock(java.lang.Runnable runnable)
This allows outside code to access the timer lock, in case they need to do things that can't allow time to slip
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitschedule, schedule, scheduleAtFixedRate, scheduleAtFixedRatepublic final java.util.List<SafeTimerMock.ScheduledTask> scheduled
public static void advanceTime(long millis)
public static void resetMockTime()
public int numTasksScheduled()
public void waitForSilence()
public static long time()
public long now()
public void withTimerLock(java.lang.Runnable runnable)
public void schedule(SafeTimerTask task, long delay)
public void schedule(SafeTimerTask task, long delay, long period)
public void scheduleAtFixedRate(SafeTimerTask task, long delay, long period)
scheduleAtFixedRate in interface SafeTimerTimer.scheduleAtFixedRate(TimerTask, long, long)public void scheduleAtFixedRate(SafeTimerTask task, long period)
SafeTimerscheduleAtFixedRate in interface SafeTimerTimer.scheduleAtFixedRate(TimerTask, long, long)