| Constructor and Description |
|---|
TimerManager(int workerNum) |
TimerManager(int workerNum,
String name) |
| Modifier and Type | Method and Description |
|---|---|
ScheduledFuture<?> |
schedule(Runnable command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled
after the given delay.
|
ScheduledFuture<?> |
scheduleAtFixedRate(Runnable command,
long initialDelay,
long period,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first
after the given initial delay, and subsequently with the given
period; that is executions will commence after
initialDelay then initialDelay+period, then
initialDelay + 2 * period, and so on. |
ScheduledFuture<?> |
scheduleWithFixedDelay(Runnable command,
long initialDelay,
long delay,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first
after the given initial delay, and subsequently with the
given delay between the termination of one execution and the
commencement of the next.
|
void |
shutdown() |
public TimerManager(int workerNum)
public TimerManager(int workerNum,
String name)
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
Schedulerschedule in interface Schedulercommand - the task to executedelay - the time from now to delay executionunit - the time unit of the delay parameterget() method will return
null upon completion
scheduled for executionpublic ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
SchedulerinitialDelay then initialDelay+period, then
initialDelay + 2 * period, and so on.
If any execution of the task
encounters an exception, subsequent executions are suppressed.
Otherwise, the task will only terminate via cancellation or
termination of the executor. If any execution of this task
takes longer than its period, then subsequent executions
may start late, but will not concurrently execute.scheduleAtFixedRate in interface Schedulercommand - the task to executeinitialDelay - the time to delay first executionperiod - the period between successive executionsunit - the time unit of the initialDelay and period parametersget() method will throw an
exception upon cancellationpublic ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
SchedulerscheduleWithFixedDelay in interface Schedulercommand - the task to executeinitialDelay - 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 parametersget() method will throw an
exception upon cancellationCopyright © 2024. All rights reserved.