Class AbstractScheduledService.Scheduler
- java.lang.Object
-
- com.google.common.util.concurrent.AbstractScheduledService.Scheduler
-
- Direct Known Subclasses:
AbstractScheduledService.CustomScheduler
- Enclosing class:
- AbstractScheduledService
public abstract static class AbstractScheduledService.Scheduler extends java.lang.Object
A scheduler defines the policy for how theAbstractScheduledServiceshould run its task.Consider using the
newFixedDelaySchedule(long, long, java.util.concurrent.TimeUnit)andnewFixedRateSchedule(long, long, java.util.concurrent.TimeUnit)factory methods, these provideAbstractScheduledService.Schedulerinstances for the common use case of running the service with a fixed schedule. If more flexibility is needed then consider subclassingAbstractScheduledService.CustomScheduler.- Since:
- 11.0
- Author:
- Luke Sandberg
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AbstractScheduledService.SchedulernewFixedDelaySchedule(long initialDelay, long delay, java.util.concurrent.TimeUnit unit)Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.static AbstractScheduledService.SchedulernewFixedRateSchedule(long initialDelay, long period, java.util.concurrent.TimeUnit unit)Returns aAbstractScheduledService.Schedulerthat schedules the task using theScheduledExecutorService.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)method.
-
-
-
Method Detail
-
newFixedDelaySchedule
public static AbstractScheduledService.Scheduler newFixedDelaySchedule(long initialDelay, long delay, java.util.concurrent.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 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(long initialDelay, long period, java.util.concurrent.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 executionperiod- the period between successive executions of the taskunit- the time unit of the initialDelay and period parameters
-
-