Class TestScheduler.TestWorker

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) boolean disposed  
    • Constructor Summary

      Constructors 
      Constructor Description
      TestWorker()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Dispose the resource, the operation should be idempotent.
      boolean isDisposed()
      Returns true if this resource has been disposed.
      long now​(@NonNull java.util.concurrent.TimeUnit unit)
      Returns the 'current time' of the Worker in the specified time unit.
      @NonNull Disposable schedule​(@NonNull java.lang.Runnable run)
      Schedules a Runnable for execution without any time delay.
      @NonNull Disposable schedule​(@NonNull java.lang.Runnable run, long delayTime, @NonNull java.util.concurrent.TimeUnit unit)
      Schedules an Runnable for execution at some point in the future specified by a time delay relative to the current time.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • disposed

        volatile boolean disposed
    • Constructor Detail

      • TestWorker

        TestWorker()
    • Method Detail

      • dispose

        public void dispose()
        Description copied from interface: Disposable
        Dispose the resource, the operation should be idempotent.
      • isDisposed

        public boolean isDisposed()
        Description copied from interface: Disposable
        Returns true if this resource has been disposed.
        Returns:
        true if this resource has been disposed
      • schedule

        @NonNull
        public @NonNull Disposable schedule​(@NonNull
                                            @NonNull java.lang.Runnable run,
                                            long delayTime,
                                            @NonNull
                                            @NonNull java.util.concurrent.TimeUnit unit)
        Description copied from class: Scheduler.Worker
        Schedules an Runnable for execution at some point in the future specified by a time delay relative to the current time.

        Note to implementors: non-positive delayTime should be regarded as non-delayed schedule, i.e., as if the Scheduler.Worker.schedule(Runnable) was called.

        Specified by:
        schedule in class Scheduler.Worker
        Parameters:
        run - the Runnable to schedule
        delayTime - time to "wait" before executing the action; non-positive values indicate an non-delayed schedule
        unit - the time unit of delayTime
        Returns:
        a Disposable to be able to unsubscribe the action (cancel it if not executed)
      • now

        public long now​(@NonNull
                        @NonNull java.util.concurrent.TimeUnit unit)
        Description copied from class: Scheduler.Worker
        Returns the 'current time' of the Worker in the specified time unit.
        Overrides:
        now in class Scheduler.Worker
        Parameters:
        unit - the time unit
        Returns:
        the 'current time'