public class SchedulerExecutorDelegator extends AbstractSubmitterScheduler
DefaultPriorityWrapper
to
have a different default priority for scheduled tasks vs executed).Constructor and Description |
---|
SchedulerExecutorDelegator(java.util.concurrent.Executor parentExecutor,
SubmitterScheduler parentScheduler)
Constructs a new delegator with the provided pools to defer executions to.
|
Modifier and Type | Method and Description |
---|---|
void |
scheduleAtFixedRate(java.lang.Runnable task,
long initialDelay,
long period)
Schedule a fixed rate recurring task to run.
|
void |
scheduleWithFixedDelay(java.lang.Runnable task,
long initialDelay,
long recurringDelay)
Schedule a fixed delay recurring task to run.
|
schedule, submitScheduled, submitScheduled
execute, submit, submit
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
submitScheduled
submit, submit, submit
public SchedulerExecutorDelegator(java.util.concurrent.Executor parentExecutor, SubmitterScheduler parentScheduler)
parentExecutor
- Executor to use when ever possibleparentScheduler
- Scheduler to use when executions need to be delayedpublic void scheduleWithFixedDelay(java.lang.Runnable task, long initialDelay, long recurringDelay)
SubmitterScheduler
recurringDelay + runtime
for the provided task.
Unlike ScheduledExecutorService
if the task throws an exception,
subsequent executions are NOT suppressed or prevented. So if the task throws an exception on
every run, the task will continue to be executed at the provided recurring delay (possibly
throwing an exception on each execution).
task
- runnable to be executedinitialDelay
- delay in milliseconds until first runrecurringDelay
- delay in milliseconds for running task after last finishpublic void scheduleAtFixedRate(java.lang.Runnable task, long initialDelay, long period)
SubmitterScheduler
Unlike ScheduledExecutorService
if the task throws an exception,
subsequent executions are NOT suppressed or prevented. So if the task throws an exception on
every run, the task will continue to be executed at the provided recurring delay (possibly
throwing an exception on each execution).
task
- runnable to be executedinitialDelay
- delay in milliseconds until first runperiod
- amount of time in milliseconds between the start of recurring executions