Class EmbeddedEventLoop.FreezableTicker
java.lang.Object
io.netty.channel.embedded.EmbeddedEventLoop.FreezableTicker
- All Implemented Interfaces:
MockTicker, Ticker
- Enclosing class:
EmbeddedEventLoop
Ticker that implements the old
EmbeddedChannel time freezing mechanics.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longWhen time is frozen, the timestamp returned byEmbeddedEventLoop.getCurrentTimeNanos().private longWhen time is notfrozen, the base time to subtract fromSystem.nanoTime().private booleanWhether time is currently frozen.private final Ticker -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadvance(long amount, java.util.concurrent.TimeUnit unit) Advances the currentTicker.nanoTime()by the given amount of time.voidlongnanoTime()The time elapsed since initialization of this class in nanoseconds.voidsleep(long delay, java.util.concurrent.TimeUnit unit) Waits until the given amount of time goes by.voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MockTicker
advanceMillis, initialNanoTimeMethods inherited from interface Ticker
sleepMillis
-
Field Details
-
unfrozen
-
startTime
private long startTimeWhen time is notfrozen, the base time to subtract fromSystem.nanoTime(). When time is frozen, this variable is unused. -
frozenTimestamp
private long frozenTimestampWhen time is frozen, the timestamp returned byEmbeddedEventLoop.getCurrentTimeNanos(). When unfrozen, this is unused. -
timeFrozen
private boolean timeFrozenWhether time is currently frozen.
-
-
Constructor Details
-
FreezableTicker
FreezableTicker()
-
-
Method Details
-
advance
public void advance(long amount, java.util.concurrent.TimeUnit unit) Description copied from interface:MockTickerAdvances the currentTicker.nanoTime()by the given amount of time.- Specified by:
advancein interfaceMockTicker- Parameters:
amount- the amount of time to advance this ticker by.unit- theTimeUnitofamount.
-
nanoTime
-
sleep
public void sleep(long delay, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException Description copied from interface:TickerWaits until the given amount of time goes by. -
freezeTime
public void freezeTime() -
unfreezeTime
public void unfreezeTime()
-