public abstract static class AbstractScheduledService.Scheduler
extends java.lang.Object
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
.
Modifier | Constructor and Description |
---|---|
private |
Scheduler() |
Modifier and Type | Method and Description |
---|---|
static AbstractScheduledService.Scheduler |
newFixedDelaySchedule(java.time.Duration initialDelay,
java.time.Duration delay)
Returns a
AbstractScheduledService.Scheduler that schedules the task using the ScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) method. |
static AbstractScheduledService.Scheduler |
newFixedDelaySchedule(long initialDelay,
long delay,
java.util.concurrent.TimeUnit unit)
Returns a
AbstractScheduledService.Scheduler that schedules the task using the ScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) method. |
static AbstractScheduledService.Scheduler |
newFixedRateSchedule(java.time.Duration initialDelay,
java.time.Duration period)
Returns a
AbstractScheduledService.Scheduler that schedules the task using the ScheduledExecutorService.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) method. |
static AbstractScheduledService.Scheduler |
newFixedRateSchedule(long initialDelay,
long period,
java.util.concurrent.TimeUnit unit)
Returns a
AbstractScheduledService.Scheduler that schedules the task using the ScheduledExecutorService.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) method. |
(package private) abstract AbstractScheduledService.Cancellable |
schedule(AbstractService service,
java.util.concurrent.ScheduledExecutorService executor,
java.lang.Runnable runnable)
Schedules the task to run on the provided executor on behalf of the service.
|
public static AbstractScheduledService.Scheduler newFixedDelaySchedule(java.time.Duration initialDelay, java.time.Duration delay)
AbstractScheduledService.Scheduler
that schedules the task using the ScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
method.initialDelay
- the time to delay first executiondelay
- the delay between the termination of one execution and the commencement of the
nextpublic static AbstractScheduledService.Scheduler newFixedDelaySchedule(long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
AbstractScheduledService.Scheduler
that schedules the task using the ScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
method.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 parameterspublic static AbstractScheduledService.Scheduler newFixedRateSchedule(java.time.Duration initialDelay, java.time.Duration period)
AbstractScheduledService.Scheduler
that schedules the task using the ScheduledExecutorService.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
method.initialDelay
- the time to delay first executionperiod
- the period between successive executions of the taskpublic static AbstractScheduledService.Scheduler newFixedRateSchedule(long initialDelay, long period, java.util.concurrent.TimeUnit unit)
AbstractScheduledService.Scheduler
that schedules the task using the ScheduledExecutorService.scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
method.initialDelay
- the time to delay first executionperiod
- the period between successive executions of the taskunit
- the time unit of the initialDelay and period parametersabstract AbstractScheduledService.Cancellable schedule(AbstractService service, java.util.concurrent.ScheduledExecutorService executor, java.lang.Runnable runnable)