Module dev.mccue.guava.concurrent
Package dev.mccue.guava.concurrent
Class AbstractScheduledService.Scheduler
java.lang.Object
dev.mccue.guava.concurrent.AbstractScheduledService.Scheduler
- Direct Known Subclasses:
AbstractScheduledService.CustomScheduler
- Enclosing class:
- AbstractScheduledService
A scheduler defines the policy for how the
AbstractScheduledService should run its
task.
Consider using the #newFixedDelaySchedule and #newFixedRateSchedule factory
methods, these provide Scheduler instances for the common use case of running the
service with a fixed schedule. If more flexibility is needed then consider subclassing
CustomScheduler.
- Since:
- 11.0
- Author:
- Luke Sandberg
-
Method Summary
Modifier and TypeMethodDescriptionnewFixedDelaySchedule(long initialDelay, long delay, TimeUnit unit) Returns aSchedulerthat schedules the task using theScheduledExecutorService#scheduleWithFixedDelaymethod.newFixedDelaySchedule(Duration initialDelay, Duration delay) Returns aSchedulerthat schedules the task using theScheduledExecutorService#scheduleWithFixedDelaymethod.newFixedRateSchedule(long initialDelay, long period, TimeUnit unit) Returns aSchedulerthat schedules the task using theScheduledExecutorService#scheduleAtFixedRatemethod.newFixedRateSchedule(Duration initialDelay, Duration period) Returns aSchedulerthat schedules the task using theScheduledExecutorService#scheduleAtFixedRatemethod.
-
Method Details
-
newFixedDelaySchedule
public static AbstractScheduledService.Scheduler newFixedDelaySchedule(Duration initialDelay, Duration delay) Returns aSchedulerthat schedules the task using theScheduledExecutorService#scheduleWithFixedDelaymethod.- Parameters:
initialDelay- the time to delay first executiondelay- the delay between the termination of one execution and the commencement of the next- Since:
- 28.0
-
newFixedDelaySchedule
public static AbstractScheduledService.Scheduler newFixedDelaySchedule(long initialDelay, long delay, TimeUnit unit) Returns aSchedulerthat schedules the task using theScheduledExecutorService#scheduleWithFixedDelaymethod.- Parameters:
initialDelay- the time to delay first executiondelay- the delay between the termination of one execution and the commencement of the nextunit- the time unit of the initialDelay and delay parameters
-
newFixedRateSchedule
public static AbstractScheduledService.Scheduler newFixedRateSchedule(Duration initialDelay, Duration period) Returns aSchedulerthat schedules the task using theScheduledExecutorService#scheduleAtFixedRatemethod.- Parameters:
initialDelay- the time to delay first executionperiod- the period between successive executions of the task- Since:
- 28.0
-
newFixedRateSchedule
public static AbstractScheduledService.Scheduler newFixedRateSchedule(long initialDelay, long period, TimeUnit unit) Returns aSchedulerthat schedules the task using theScheduledExecutorService#scheduleAtFixedRatemethod.- Parameters:
initialDelay- the time to delay first executionperiod- the period between successive executions of the taskunit- the time unit of the initialDelay and period parameters
-