public abstract class HashWheelTask extends Object
Constructor and Description |
---|
HashWheelTask()
构造函数
|
HashWheelTask(int interval,
boolean asynchronous)
构造函数
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
取消当前任务
|
boolean |
doTask()
步进一次
|
long |
getDoCount()
获取任务执行的次数
|
int |
getInterval()
获取当前任务的槽间隔
|
int |
getSkipTick()
获取跳跃的轮次数
|
int |
getSlot()
获取当前任务的槽位
|
protected void |
init(int skipTick,
int interval,
boolean asynchronous,
HashWheel hashWheel,
int slot) |
boolean |
isAsynchronous()
是否是异步任务
|
boolean |
isCancel()
判断任务是否已经取消
|
static HashWheelTask |
newInstance(Runnable runnable) |
abstract void |
run()
运行 Task
|
void |
setAsynchronous(boolean asynchronous)
设置是否是异步任务
|
void |
setInterval(int interval)
设置当前任务的槽间隔
|
void |
setSkipTick(int skipTick)
设置跳跃的轮次数
|
public HashWheelTask()
public HashWheelTask(int interval, boolean asynchronous)
interval
- 任务的槽间隔数asynchronous
- 是否异步执行protected void init(int skipTick, int interval, boolean asynchronous, HashWheel hashWheel, int slot)
public boolean isCancel()
public int getSkipTick()
public void setSkipTick(int skipTick)
skipTick
- 跳跃的轮次数public int getInterval()
public void setInterval(int interval)
interval
- 当前任务槽间隔,单位: 秒public boolean isAsynchronous()
public void setAsynchronous(boolean asynchronous)
asynchronous
- true: 异步任务, false: 同步任务public int getSlot()
public long getDoCount()
public boolean cancel()
public abstract void run()
public boolean doTask()
public static HashWheelTask newInstance(Runnable runnable)
Copyright © 2020 Voovan. All rights reserved.