JavaScript is disabled on your browser.
Skip navigation links
io.reactivex.rxjava3.schedulers

Class TestScheduler

    • Constructor Detail

      • TestScheduler

        public TestScheduler()
        Creates a new TestScheduler with initial virtual time of zero.
      • TestScheduler

        public TestScheduler(boolean useOnScheduleHook)
        Creates a new TestScheduler with the option to use the RxJavaPlugins.onSchedule(Runnable) hook when scheduling tasks.

        History: 3.0.10 - experimental

        Parameters:
        useOnScheduleHook - if true, the tasks submitted to this TestScheduler is wrapped via the RxJavaPlugins.onSchedule(Runnable) hook
        Since:
        3.1.0
      • TestScheduler

        public TestScheduler(long delayTime,
         TimeUnit unit)
        Creates a new TestScheduler with the specified initial virtual time.
        Parameters:
        delayTime - the point in time to move the Scheduler's clock to
        unit - the units of time that delayTime is expressed in
      • TestScheduler

        public TestScheduler(long delayTime,
         TimeUnit unit,
         boolean useOnScheduleHook)
        Creates a new TestScheduler with the specified initial virtual time and with the option to use the RxJavaPlugins.onSchedule(Runnable) hook when scheduling tasks.

        History: 3.0.10 - experimental

        Parameters:
        delayTime - the point in time to move the Scheduler's clock to
        unit - the units of time that delayTime is expressed in
        useOnScheduleHook - if true, the tasks submitted to this TestScheduler is wrapped via the RxJavaPlugins.onSchedule(Runnable) hook
        Since:
        3.1.0
    • Method Detail

      • now

        public long now(@NonNull
         @NonNull TimeUnit unit)
        Description copied from class: Scheduler
        Returns the 'current time' of the Scheduler in the specified time unit.
        Overrides:
        now in class Scheduler
        Parameters:
        unit - the time unit
        Returns:
        the 'current time'
      • advanceTimeBy

        public void advanceTimeBy(long delayTime,
         TimeUnit unit)
        Moves the Scheduler's clock forward by a specified amount of time.
        Parameters:
        delayTime - the amount of time to move the Scheduler's clock forward
        unit - the units of time that delayTime is expressed in
      • advanceTimeTo

        public void advanceTimeTo(long delayTime,
         TimeUnit unit)
        Moves the Scheduler's clock to a particular moment in time.
        Parameters:
        delayTime - the point in time to move the Scheduler's clock to
        unit - the units of time that delayTime is expressed in
      • triggerActions

        public void triggerActions()
        Triggers any actions that have not yet been triggered and that are scheduled to be triggered at or before this Scheduler's present time.
      • createWorker

        @NonNull
        public @NonNull Scheduler.Worker createWorker()
        Description copied from class: Scheduler
        Retrieves or creates a new Scheduler.Worker that represents sequential execution of actions.

        When work is completed, the Worker instance should be released by calling Disposable.dispose() to avoid potential resource leaks in the underlying task-execution scheme.

        Work on a Scheduler.Worker is guaranteed to be sequential and non-overlapping.

        Specified by:
        createWorker in class Scheduler
        Returns:
        a Worker representing a serial queue of actions to be executed
Skip navigation links

AltStyle によって変換されたページ (->オリジナル) /