public interface SubmitterScheduler extends SubmitterExecutor
Modifier and Type | Method and Description |
---|---|
void |
schedule(java.lang.Runnable task,
long delayInMs)
Schedule a one time task with a given delay.
|
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.
|
<T> ListenableFuture<T> |
submitScheduled(java.util.concurrent.Callable<T> task,
long delayInMs)
Schedule a
Callable with a given delay. |
default ListenableFuture<?> |
submitScheduled(java.lang.Runnable task,
long delayInMs)
Schedule a task with a given delay.
|
<T> ListenableFuture<T> |
submitScheduled(java.lang.Runnable task,
T result,
long delayInMs)
Schedule a task with a given delay.
|
submit, submit, submit
void schedule(java.lang.Runnable task, long delayInMs)
task
- runnable to executedelayInMs
- time in milliseconds to wait to execute taskvoid scheduleWithFixedDelay(java.lang.Runnable task, long initialDelay, long recurringDelay)
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 finishvoid scheduleAtFixedRate(java.lang.Runnable task, long initialDelay, long period)
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 executionsdefault ListenableFuture<?> submitScheduled(java.lang.Runnable task, long delayInMs)
submitScheduled(Runnable, long)
over schedule(Runnable, long)
. So this
should only be used when the future is necessary.
The Future.get()
method will return null
once the runnable has
completed.
task
- runnable to executedelayInMs
- time in milliseconds to wait to execute task<T> ListenableFuture<T> submitScheduled(java.lang.Runnable task, T result, long delayInMs)
Future.get()
method will return
the provided result once the runnable has completed.T
- type of result returned from the futuretask
- runnable to executeresult
- result to be returned from resulting future .get() when runnable completesdelayInMs
- time in milliseconds to wait to execute task<T> ListenableFuture<T> submitScheduled(java.util.concurrent.Callable<T> task, long delayInMs)
Callable
with a given delay. This is needed when a result needs to be
consumed from the callable.T
- type of result returned from the futuretask
- callable to be executeddelayInMs
- time in milliseconds to wait to execute task