| 限定符和类型 | 字段和说明 |
|---|---|
protected long |
deadline |
protected TimerTask |
task |
protected Timer |
timer |
ST_CANCELLED, ST_EXPIRED, ST_INIT| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractTimeout(Timer timer,
TimerTask task,
long deadline) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
compareAndSetState(int expected,
int state) |
void |
executeTask() |
boolean |
isCancelled()
Returns
true if and only if the TimerTask associated
with this handle has been cancelled. |
boolean |
isExpired()
Returns
true if and only if the TimerTask associated
with this handle has been expired. |
void |
run() |
int |
state() |
TimerTask |
task()
Returns the
TimerTask which is associated with this handle. |
Timer |
timer()
Returns the
Timer that created this handle. |
protected final Timer timer
protected final TimerTask task
protected final long deadline
public boolean compareAndSetState(int expected,
int state)
public int state()
public boolean isCancelled()
Timeouttrue if and only if the TimerTask associated
with this handle has been cancelled.isCancelled 在接口中 Timeoutpublic boolean isExpired()
Timeouttrue if and only if the TimerTask associated
with this handle has been expired.public void executeTask()
executeTask() -> timer.getTaskExecutor().execute(this) => 在 executor中执行 timeout.run()方法 => 在executor 中执行 TimerTask
Copyright © 2022. All rights reserved.