public class Timer extends Object
| Constructor and Description |
|---|
Timer(@NotNull EventLoop eventLoop)
Constructs a Timer with the default system time provider.
|
Timer(@NotNull EventLoop eventLoop,
@NotNull TimeProvider timeProvider)
Constructs a Timer with a specified time provider.
|
| Modifier and Type | Method and Description |
|---|---|
void |
schedule(@NotNull Runnable eventHandler,
long initialDelayMs)
Schedule a handler to run once after a delay
|
void |
scheduleAtFixedRate(@NotNull VanillaEventHandler eventHandler,
long initialDelayMs,
long periodMs)
uses the event loop thread to call the event handler periodically, the time that the event is
called back is best-effort, but if the thread is busy that call back maybe delayed
|
void |
scheduleAtFixedRate(@NotNull VanillaEventHandler eventHandler,
long initialDelayMs,
long periodMs,
HandlerPriority priority)
uses the event loop thread to call the event handler periodically, the time that the event is
called back is best-effort, but if the thread is busy that call back maybe delayed
|
public Timer(@NotNull
@NotNull EventLoop eventLoop)
eventLoop - the event loop on which the timer tasks are scheduled and run.public Timer(@NotNull
@NotNull EventLoop eventLoop,
@NotNull
@NotNull TimeProvider timeProvider)
eventLoop - the event loop on which the timer tasks are scheduled and run.timeProvider - the time provider used to control the scheduling.public void scheduleAtFixedRate(@NotNull
@NotNull VanillaEventHandler eventHandler,
long initialDelayMs,
long periodMs)
eventHandler - the handler to be called backinitialDelayMs - how long in milliseconds to wait before being called backperiodMs - the poll interval of being calledpublic void scheduleAtFixedRate(@NotNull
@NotNull VanillaEventHandler eventHandler,
long initialDelayMs,
long periodMs,
HandlerPriority priority)
eventHandler - the handler to be called backinitialDelayMs - how long in milliseconds to wait before being called backperiodMs - the poll interval of being calledpriority - the priority of the event handlerpublic void schedule(@NotNull
@NotNull Runnable eventHandler,
long initialDelayMs)
eventHandler - the handler to be called backinitialDelayMs - how long in milliseconds to wait before being called backCopyright © 2024. All rights reserved.