public class SystemTimer extends Object implements Timer, Consumer<TimerTaskEntry>
| Constructor and Description |
|---|
SystemTimer() |
SystemTimer(long tickMs,
int wheelSize,
long startMs,
String executeName) |
SystemTimer(long tickMs,
int wheelSize,
String executeName) |
SystemTimer(String executeName) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(TimerTaskEntry timerTaskEntry)
Applies this function to the given argument.
|
void |
add(TimerTask timerTask)
添加新的任务到当前执行器(线程池),在任务过期后会执行任务。
|
boolean |
advanceClock(long timeoutMs)
推进内部时钟,执行任何在走过的时间间隔内过期的任务
|
void |
shutdown()
关闭定时器服务,待执行的任务将不会被执行
|
long |
size()
取得待执行的任务数量
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHiresClockMspublic SystemTimer()
public SystemTimer(String executeName)
public SystemTimer(long tickMs,
int wheelSize,
String executeName)
public SystemTimer(long tickMs,
int wheelSize,
long startMs,
String executeName)
public void add(TimerTask timerTask)
Timerpublic boolean advanceClock(long timeoutMs)
TimeradvanceClock in interface TimertimeoutMs - timeoutMspublic long size()
Timerpublic void shutdown()
Timerpublic void accept(TimerTaskEntry timerTaskEntry)
accept in interface Consumer<TimerTaskEntry>timerTaskEntry - the function argumentCopyright © 2025. All rights reserved.