You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "kexianjun (GitHub)" <gi...@apache.org> on 2019/01/22 09:12:43 UTC
[GitHub] [incubator-dubbo] kexianjun commented on pull request #3299:
Optimize heartbeat
timeout.cancel will never success when the task has expired once,because in this case it's status will be ST_EXPIRED , and in this case, based on org.apache.dubbo.common.timer.HashedWheelTimer.HashedWheelTimeout#cancel method code as following
```
public boolean cancel() {
// only update the state it will be removed from HashedWheelBucket on next tick.
if (!compareAndSetState(ST_INIT, ST_CANCELLED)) {
return false;
}
// If a task should be canceled we put this to another queue which will be processed on each tick.
// So this means that we will have a GC latency of max. 1 tick duration which is good enough. This way
// we can make again use of our MpscLinkedQueue and so minimize the locking / overhead as much as possible.
timer.cancelledTimeouts.add(this);
return true;
}
```
compareAndSetState will always reture false. Am I right?
[ Full content available at: https://github.com/apache/incubator-dubbo/pull/3299 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org