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 TypeMethodDescriptionvoidAdvances the currentTicker.nanoTime()by the given amount of time.voidlongnanoTime()The time elapsed since initialization of this class in nanoseconds.voidWaits until the given amount of time goes by.voidMethods inherited from class 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
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
public long nanoTime()Description copied from interface:TickerThe time elapsed since initialization of this class in nanoseconds. This may return a negative number just likeSystem.nanoTime(). -
sleep
Description copied from interface:TickerWaits until the given amount of time goes by.- Specified by:
sleepin interfaceTicker- Parameters:
delay- the amount of delay.unit- theTimeUnitofdelay.- Throws:
InterruptedException- See Also:
-
freezeTime
public void freezeTime() -
unfreezeTime
public void unfreezeTime()
-