Package dev.failsafe.internal.util
Class DelegatingScheduler
- java.lang.Object
-
- dev.failsafe.internal.util.DelegatingScheduler
-
- All Implemented Interfaces:
Scheduler
public final class DelegatingScheduler extends java.lang.Object implements Scheduler
ASchedulerimplementation that schedules delays on an internal, common ScheduledExecutorService and executes tasks on either a providedExecutorService,ForkJoinPool.commonPool(), or an internalForkJoinPoolinstance. If noExecutorServiceis supplied, theForkJoinPool.commonPool()will be used, unless the common pool's parallelism is 1, then an internalForkJoinPoolwith parallelism of 2 will be created and used.Supports cancellation and interruption of
ForkJoinPooltasks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDelegatingScheduler.DelayerThreadFactory(package private) static classDelegatingScheduler.ScheduledCompletableFuture<V>
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.ScheduledThreadPoolExecutorDELAYERprivate java.util.concurrent.ExecutorServiceexecutorServiceprivate static java.util.concurrent.ForkJoinPoolFORK_JOIN_POOLstatic DelegatingSchedulerINSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateDelegatingScheduler()DelegatingScheduler(java.util.concurrent.ExecutorService executor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.util.concurrent.ScheduledExecutorServicedelayer()private java.util.concurrent.ExecutorServiceexecutorService()java.util.concurrent.ScheduledFuture<?>schedule(java.util.concurrent.Callable<?> callable, long delay, java.util.concurrent.TimeUnit unit)Schedules thecallableto be called after thedelayfor theunit.
-
-
-
Field Detail
-
INSTANCE
public static final DelegatingScheduler INSTANCE
-
FORK_JOIN_POOL
private static volatile java.util.concurrent.ForkJoinPool FORK_JOIN_POOL
-
DELAYER
private static volatile java.util.concurrent.ScheduledThreadPoolExecutor DELAYER
-
executorService
private final java.util.concurrent.ExecutorService executorService
-
-
Method Detail
-
delayer
private static java.util.concurrent.ScheduledExecutorService delayer()
-
executorService
private java.util.concurrent.ExecutorService executorService()
-
schedule
public java.util.concurrent.ScheduledFuture<?> schedule(java.util.concurrent.Callable<?> callable, long delay, java.util.concurrent.TimeUnit unit)Description copied from interface:SchedulerSchedules thecallableto be called after thedelayfor theunit.
-
-