mirror of
https://gitee.com/jd-platform-opensource/asyncTool.git
synced 2026-03-22 04:27:15 +08:00
超时时间轮---完成
This commit is contained in:
@@ -98,12 +98,11 @@ public class TimeWheel {
|
||||
TimerTaskList timerTaskList = timerTaskLists[index];
|
||||
timerTaskList.addTask(timerTask);
|
||||
if (timerTaskList.setExpiration(virtualId * tickMs)) {
|
||||
//添加到delayList中
|
||||
//TODO 改成加到list对应元素 【20槽, 时间轮层数】,这里添加前一定要初始化到对应层数
|
||||
//加到delayList对应元素 【20槽, 时间轮层数】,这里添加前一定要初始化到对应层数
|
||||
while (delayList.get(index).size() < overflowIndex + 1) {
|
||||
delayList.get(index).add(new TimerTaskList());
|
||||
}
|
||||
//TODO 想办法只设置一次
|
||||
//这里每次清空整个槽位的List,并且flush List的元素链表,所以没问题
|
||||
delayList.get(index).set(overflowIndex, timerTaskList);
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user