Class EmbeddedEventLoop.FreezableTicker

    • Field Detail

      • unfrozen

        private final Ticker unfrozen
      • startTime

        private long startTime
        When time is not frozen, the base time to subtract from System.nanoTime(). When time is frozen, this variable is unused.
      • timeFrozen

        private boolean timeFrozen
        Whether time is currently frozen.
    • Constructor Detail

      • FreezableTicker

        FreezableTicker()
    • Method Detail

      • advance

        public void advance​(long amount,
                            java.util.concurrent.TimeUnit unit)
        Description copied from interface: MockTicker
        Advances the current Ticker.nanoTime() by the given amount of time.
        Specified by:
        advance in interface MockTicker
        Parameters:
        amount - the amount of time to advance this ticker by.
        unit - the TimeUnit of amount.
      • nanoTime

        public long nanoTime()
        Description copied from interface: Ticker
        The time elapsed since initialization of this class in nanoseconds. This may return a negative number just like System.nanoTime().
        Specified by:
        nanoTime in interface Ticker
      • sleep

        public void sleep​(long delay,
                          java.util.concurrent.TimeUnit unit)
                   throws java.lang.InterruptedException
        Description copied from interface: Ticker
        Waits until the given amount of time goes by.
        Specified by:
        sleep in interface Ticker
        Parameters:
        delay - the amount of delay.
        unit - the TimeUnit of delay.
        Throws:
        java.lang.InterruptedException
        See Also:
        Thread.sleep(long)
      • freezeTime

        public void freezeTime()
      • unfreezeTime

        public void unfreezeTime()