Package reactor.scheduler.forkjoin
Class ForkJoinPoolScheduler
java.lang.Object
reactor.scheduler.forkjoin.ForkJoinPoolScheduler
- All Implemented Interfaces:
Disposable,Scheduler
-
Nested Class Summary
Nested classes/interfaces inherited from interface reactor.core.Disposable
Disposable.Composite, Disposable.Swap -
Method Summary
Modifier and TypeMethodDescriptionstatic Schedulercreate(int parallelism, ForkJoinPool.ForkJoinWorkerThreadFactory workerThreadFactory, Scheduler timeScheduler) Schedulerthat utilizes aForkJoinPoolfor workers and is suited for parallel work.static SchedulerSchedulerthat hosts a fixed pool of single-threaded ExecutorService-based workers and is suited for parallel work.static SchedulerSchedulerthat utilizes aForkJoinPoolfor workers and is suited for parallel work.voiddispose()booleanstatic voidonHandleError(BiConsumer<Thread, ? super Throwable> c) Define a hook that is executed when aSchedulerhashandled an error.static voidReset theonHandleError(BiConsumer)hook to the default no-op behavior.schedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface reactor.core.scheduler.Scheduler
disposeGracefully, init, now, start
-
Method Details
-
create
Schedulerthat hosts a fixed pool of single-threaded ExecutorService-based workers and is suited for parallel work.- Parameters:
name- Thread prefix- Returns:
- a new
Schedulerthat hosts a fixed pool of single-threaded ExecutorService-based workers and is suited for parallel work
-
create
Schedulerthat utilizes aForkJoinPoolfor 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 prefixparallelism- Number of worker threads- Returns:
- a new
Schedulerthat utilizes a ForkJoinPool
-
create
public static Scheduler create(int parallelism, ForkJoinPool.ForkJoinWorkerThreadFactory workerThreadFactory, Scheduler timeScheduler) Schedulerthat utilizes aForkJoinPoolfor 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 threadsworkerThreadFactory- factory for ForkJoinPool thradstimeScheduler- Scheduler to use for timed tasks- Returns:
- a new
Schedulerthat utilizes a ForkJoinPool
-
onHandleError
Define a hook that is executed when aSchedulerhashandled 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 (seeExceptions.throwIfJvmFatal(Throwable)).- Parameters:
c- the new hook to set.
-
resetOnHandleError
public static void resetOnHandleError()Reset theonHandleError(BiConsumer)hook to the default no-op behavior. -
createWorker
- Specified by:
createWorkerin interfaceScheduler
-
dispose
public void dispose()- Specified by:
disposein interfaceDisposable- Specified by:
disposein interfaceScheduler
-
isDisposed
public boolean isDisposed()- Specified by:
isDisposedin interfaceDisposable
-
schedule
-
schedule
-
schedulePeriodically
public Disposable schedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit) - Specified by:
schedulePeriodicallyin interfaceScheduler
-