public class SystemTimer extends Object implements Timer, Function<TimerTaskEntry,Void>
| 构造器和说明 |
|---|
SystemTimer() |
SystemTimer(long tickMs,
int wheelSize,
long startMs,
String executeName) |
SystemTimer(long tickMs,
int wheelSize,
String executeName) |
SystemTimer(String executeName) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(TimerTask timerTask)
添加新的任务到当前执行器(线程池),在任务过期后会执行任务。
|
boolean |
advanceClock(long timeoutMs)
推进内部时钟,执行任何在走过的时间间隔内过期的任务
|
Void |
apply(TimerTaskEntry timerTaskEntry)
Applies this function to the given argument.
|
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 boolean advanceClock(long timeoutMs)
TimeradvanceClock 在接口中 TimertimeoutMs - timeoutMspublic Void apply(TimerTaskEntry timerTaskEntry)
apply 在接口中 Function<TimerTaskEntry,Void>timerTaskEntry - the function argumentCopyright © 2022. All rights reserved.