public static interface Schedulers.Factory
| Modifier and Type | Method and Description |
|---|---|
default Scheduler |
newBoundedElastic(int threadCap,
int queuedTaskCap,
ThreadFactory threadFactory,
int ttlSeconds)
Scheduler that dynamically creates a bounded number of ExecutorService-based
Workers, reusing them once the Workers have been shut down. |
default Scheduler |
newElastic(int ttlSeconds,
ThreadFactory threadFactory)
Deprecated.
use
newBoundedElastic(int, int, ThreadFactory, int), to be removed in 3.5.0 |
default Scheduler |
newParallel(int parallelism,
ThreadFactory threadFactory)
Scheduler that hosts a fixed pool of workers and is suited for parallel
work. |
default Scheduler |
newSingle(ThreadFactory threadFactory)
Scheduler that hosts a single worker and is suited for non-blocking
work. |
@Deprecated default Scheduler newElastic(int ttlSeconds, ThreadFactory threadFactory)
newBoundedElastic(int, int, ThreadFactory, int), to be removed in 3.5.0Scheduler that dynamically creates Workers resources and caches
eventually, reusing them once the Workers have been shut down.
The maximum number of created workers is unbounded.
ttlSeconds - Time-to-live for an idle Scheduler.WorkerthreadFactory - a ThreadFactory to useScheduler that dynamically creates Workers resources and
caches eventually, reusing them once the Workers have been shut downdefault Scheduler newBoundedElastic(int threadCap, int queuedTaskCap, ThreadFactory threadFactory, int ttlSeconds)
Scheduler that dynamically creates a bounded number of ExecutorService-based
Workers, reusing them once the Workers have been shut down. The underlying (user or daemon)
threads can be evicted if idle for more than ttlSeconds.
The maximum number of created thread pools is bounded by the provided cap.
threadCap - maximum number of underlying threads to createqueuedTaskCap - maximum number of tasks to enqueue when no more threads can be created. Can be Integer.MAX_VALUE for unbounded enqueueing.threadFactory - a ThreadFactory to use each thread initializationttlSeconds - Time-to-live for an idle Scheduler.WorkerScheduler that dynamically creates workers with an upper bound to
the number of backing threads, reuses threads and evict idle onesdefault Scheduler newParallel(int parallelism, ThreadFactory threadFactory)
Scheduler that hosts a fixed pool of workers and is suited for parallel
work.parallelism - Number of pooled workers.threadFactory - a ThreadFactory to use for the fixed initialized
number of ThreadScheduler that hosts a fixed pool of workers and is
suited for parallel workdefault Scheduler newSingle(ThreadFactory threadFactory)
Scheduler that hosts a single worker and is suited for non-blocking
work.threadFactory - a ThreadFactory to use for the unique resource of
the SchedulerScheduler that hosts a single worker