public interface Scheduler
Modifier and Type | Method and Description |
---|---|
void |
resizeThreadPool(int newSize) |
ScheduledFuture<?> |
schedule(String name,
Runnable task,
long delayMs,
long periodMs)
Schedule a task.
|
default ScheduledFuture<?> |
scheduleOnce(String name,
Runnable task) |
default ScheduledFuture<?> |
scheduleOnce(String name,
Runnable task,
long delayMs) |
void |
shutdown()
Shutdown this scheduler.
|
void |
startup()
Initialize this scheduler so it is ready to accept scheduling of tasks
|
void startup()
void shutdown() throws InterruptedException
InterruptedException
default ScheduledFuture<?> scheduleOnce(String name, Runnable task)
default ScheduledFuture<?> scheduleOnce(String name, Runnable task, long delayMs)
ScheduledFuture<?> schedule(String name, Runnable task, long delayMs, long periodMs)
name
- The name of this tasktask
- The task to rundelayMs
- The number of milliseconds to wait before the first executionperiodMs
- The period in milliseconds with which to execute the task. If < 0 the task will execute only once.void resizeThreadPool(int newSize)