Class IoScheduler

java.lang.Object
io.reactivex.rxjava3.core.Scheduler
io.reactivex.rxjava3.internal.schedulers.IoScheduler

public final class IoScheduler extends Scheduler
Scheduler that creates and caches a set of thread pools and reuses them if possible.
  • Field Details

  • Constructor Details

    • IoScheduler

      public IoScheduler()
    • IoScheduler

      public IoScheduler(ThreadFactory threadFactory)
      Constructs an IoScheduler with the given thread factory and starts the pool of workers.
      Parameters:
      threadFactory - thread factory to use for creating worker threads. Note that this takes precedence over any system properties for configuring new thread creation. Cannot be null.
  • Method Details

    • start

      public void start()
      Description copied from class: Scheduler
      Allows the Scheduler instance to start threads and accept tasks on them.

      Implementations should make sure the call is idempotent, thread-safe and should not throw any RuntimeException if it doesn't support this functionality.

      Overrides:
      start in class Scheduler
    • shutdown

      public void shutdown()
      Description copied from class: Scheduler
      Instructs the Scheduler instance to stop threads, stop accepting tasks on any outstanding Scheduler.Worker instances and clean up any associated resources with this Scheduler.

      Implementations should make sure the call is idempotent, thread-safe and should not throw any RuntimeException if it doesn't support this functionality.

      Overrides:
      shutdown in class Scheduler
    • 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
    • size

      public int size()