public final class ForkJoinPoolScheduler extends Object implements reactor.core.scheduler.Scheduler
Modifier and Type | Method and Description |
---|---|
static reactor.core.scheduler.Scheduler |
create(int parallelism,
ForkJoinPool.ForkJoinWorkerThreadFactory workerThreadFactory,
reactor.core.scheduler.Scheduler timeScheduler)
Scheduler that utilizes a ForkJoinPool for
workers and is suited for parallel work. |
static reactor.core.scheduler.Scheduler |
create(String name)
Scheduler that hosts a fixed pool of single-threaded ExecutorService-based
workers and is suited for parallel work. |
static reactor.core.scheduler.Scheduler |
create(String name,
int parallelism)
Scheduler that utilizes a ForkJoinPool for
workers and is suited for parallel work. |
reactor.core.scheduler.Scheduler.Worker |
createWorker() |
void |
dispose() |
boolean |
isDisposed() |
static void |
onHandleError(BiConsumer<Thread,? super Throwable> c)
Define a hook that is executed when a
Scheduler has
handled an error . |
static void |
resetOnHandleError()
Reset the
onHandleError(BiConsumer) hook to the default no-op behavior. |
reactor.core.Disposable |
schedule(Runnable runnable) |
reactor.core.Disposable |
schedule(Runnable task,
long delay,
TimeUnit unit) |
reactor.core.Disposable |
schedulePeriodically(Runnable task,
long initialDelay,
long period,
TimeUnit unit) |
public static reactor.core.scheduler.Scheduler create(String name)
Scheduler
that hosts a fixed pool of single-threaded ExecutorService-based
workers and is suited for parallel work.name
- Thread prefixScheduler
that hosts a fixed pool of single-threaded
ExecutorService-based workers and is suited for parallel workpublic static reactor.core.scheduler.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 periodicname
- Thread prefixparallelism
- Number of worker threadsScheduler
that utilizes a ForkJoinPoolpublic static reactor.core.scheduler.Scheduler create(int parallelism, ForkJoinPool.ForkJoinWorkerThreadFactory workerThreadFactory, reactor.core.scheduler.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 periodicparallelism
- Number of worker threadsworkerThreadFactory
- factory for ForkJoinPool thradstimeScheduler
- Scheduler to use for timed tasksScheduler
that utilizes a ForkJoinPoolpublic static void onHandleError(BiConsumer<Thread,? super Throwable> c)
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)
).c
- the new hook to set.public static void resetOnHandleError()
onHandleError(BiConsumer)
hook to the default no-op behavior.public reactor.core.scheduler.Scheduler.Worker createWorker()
createWorker
in interface reactor.core.scheduler.Scheduler
public void dispose()
dispose
in interface reactor.core.Disposable
dispose
in interface reactor.core.scheduler.Scheduler
public boolean isDisposed()
isDisposed
in interface reactor.core.Disposable
public reactor.core.Disposable schedule(Runnable runnable)
schedule
in interface reactor.core.scheduler.Scheduler
public reactor.core.Disposable schedule(Runnable task, long delay, TimeUnit unit)
schedule
in interface reactor.core.scheduler.Scheduler