public class TimerTaskList extends Object implements Delayed
Constructor and Description |
---|
TimerTaskList()
构造
|
Modifier and Type | Method and Description |
---|---|
void |
addTask(TimerTask timerTask)
新增任务,将任务加入到双向链表的头部
|
int |
compareTo(Delayed o) |
void |
flush(Consumer<TimerTask> flush)
重新分配,即将列表中的任务全部处理
|
long |
getDelay(TimeUnit unit) |
long |
getExpire()
获取过期时间
|
void |
removeTask(TimerTask timerTask)
移除任务
|
boolean |
setExpiration(long expire)
设置过期时间
|
public boolean setExpiration(long expire)
expire
- 过期时间,单位毫秒public long getExpire()
public void addTask(TimerTask timerTask)
timerTask
- 延迟任务public void removeTask(TimerTask timerTask)
timerTask
- 任务public int compareTo(Delayed o)
compareTo
in interface Comparable<Delayed>
Copyright © 2024. All rights reserved.