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 
[email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to