Class ForkJoinPoolScheduler

java.lang.Object
reactor.scheduler.forkjoin.ForkJoinPoolScheduler
All Implemented Interfaces:
Disposable, Scheduler

public final class ForkJoinPoolScheduler extends Object implements Scheduler
  • Method Details

    • create

      public static Scheduler create(String name)
      Scheduler that hosts a fixed pool of single-threaded ExecutorService-based workers and is suited for parallel work.
      Parameters:
      name - Thread prefix
      Returns:
      a new Scheduler that hosts a fixed pool of single-threaded ExecutorService-based workers and is suited for parallel work
    • create

      public static Scheduler create(String name, int parallelism)
      Scheduler that utilizes a ForkJoinPool for workers and is suited for parallel work. Since the ForkJoinPool does not support periodic or delayed scheduling, a single Scheduler is used to enqueue any tasks that are delayed or periodic
      Parameters:
      name - Thread prefix
      parallelism - Number of worker threads
      Returns:
      a new Scheduler that utilizes a ForkJoinPool
    • create

      public static Scheduler create(int parallelism, ForkJoinPool.ForkJoinWorkerThreadFactory workerThreadFactory, Scheduler timeScheduler)
      Scheduler that utilizes a ForkJoinPool for workers and is suited for parallel work. Since the ForkJoinPool does not support periodic or delayed scheduling, a single Scheduler is used to enqueue any tasks that are delayed or periodic
      Parameters:
      parallelism - Number of worker threads
      workerThreadFactory - factory for ForkJoinPool thrads
      timeScheduler - Scheduler to use for timed tasks
      Returns:
      a new Scheduler that utilizes a ForkJoinPool
    • onHandleError

      public static void onHandleError(BiConsumer<Thread,? super Throwable> c)
      Define a hook that is executed when a Scheduler has handled an error. Note that it is executed after the error has been passed to the thread uncaughtErrorHandler, which is not the case when a fatal error occurs (see Exceptions.throwIfJvmFatal(Throwable)).
      Parameters:
      c - the new hook to set.
    • resetOnHandleError

      public static void resetOnHandleError()
      Reset the onHandleError(BiConsumer) hook to the default no-op behavior.
    • createWorker

      public Scheduler.Worker createWorker()
      Specified by:
      createWorker in interface Scheduler
    • dispose

      public void dispose()
      Specified by:
      dispose in interface Disposable
      Specified by:
      dispose in interface Scheduler
    • isDisposed

      public boolean isDisposed()
      Specified by:
      isDisposed in interface Disposable
    • schedule

      public Disposable schedule(Runnable runnable)
      Specified by:
      schedule in interface Scheduler
    • schedule

      public Disposable schedule(Runnable task, long delay, TimeUnit unit)
      Specified by:
      schedule in interface Scheduler
    • schedulePeriodically

      public Disposable schedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit)
      Specified by:
      schedulePeriodically in interface Scheduler