Class AbstractScheduledService.Scheduler
java.lang.Object
com.google.common.util.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(java.time.Duration, java.time.Duration) and newFixedRateSchedule(java.time.Duration, java.time.Duration) factory
 methods, these provide AbstractScheduledService.Scheduler instances for the common use case of running the
 service with a fixed schedule. If more flexibility is needed then consider subclassing AbstractScheduledService.CustomScheduler.
- Since:
- 11.0
- Author:
- Luke Sandberg
- 
Method SummaryModifier and TypeMethodDescriptionnewFixedDelaySchedule(long initialDelay, long delay, TimeUnit unit) Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.newFixedDelaySchedule(Duration initialDelay, Duration delay) Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.newFixedRateSchedule(long initialDelay, long period, TimeUnit unit) Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.newFixedRateSchedule(Duration initialDelay, Duration period) Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.
- 
Method Details- 
newFixedDelaySchedulepublic static AbstractScheduledService.Scheduler newFixedDelaySchedule(Duration initialDelay, Duration delay) Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.- Parameters:
- initialDelay- the time to delay first execution
- delay- the delay between the termination of one execution and the commencement of the next
- Since:
- 33.4.0 (but since 28.0 in the JRE flavor)
 
- 
newFixedDelaySchedulepublic static AbstractScheduledService.Scheduler newFixedDelaySchedule(long initialDelay, long delay, TimeUnit unit) Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.- Parameters:
- initialDelay- the time to delay first execution
- delay- the delay between the termination of one execution and the commencement of the next
- unit- the time unit of the initialDelay and delay parameters
 
- 
newFixedRateSchedulepublic static AbstractScheduledService.Scheduler newFixedRateSchedule(Duration initialDelay, Duration period) Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.- Parameters:
- initialDelay- the time to delay first execution
- period- the period between successive executions of the task
- Since:
- 33.4.0 (but since 28.0 in the JRE flavor)
 
- 
newFixedRateSchedulepublic static AbstractScheduledService.Scheduler newFixedRateSchedule(long initialDelay, long period, TimeUnit unit) Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.- Parameters:
- initialDelay- the time to delay first execution
- period- the period between successive executions of the task
- unit- the time unit of the initialDelay and period parameters
 
 
-