public class Timer extends Object
Constructor and Description |
---|
Timer(@NotNull EventLoop eventLoop) |
Timer(@NotNull EventLoop eventLoop,
@NotNull TimeProvider timeProvider) |
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 that the timer task is run onpublic Timer(@NotNull @NotNull EventLoop eventLoop, @NotNull @NotNull TimeProvider timeProvider)
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 © 2023. All rights reserved.