HashedWheelTimer TimerTask may execute after call to Timeout.cancel()
rzo at gmx.de
rzo at gmx.de
Tue Aug 9 03:54:31 EDT 2011
Hello,
given that the implementation is using "approximated times" a call to Timeout.cancel() may not cancel the task.
I think that the problem is:
public void cancel() {
if (isExpired()) {
return;
}
where isExpired checks:
System.currentTimeMillis() > deadline
Solution:
Alternative 1:
remove the check:
if (isExpired()) {
return;
}
Alternative 2:
new field:
boolean expired = false.
this is set to true in:
HashedWheelTimeout.expire()
and isExpired()
{
return canceled || expired;
}
I also propose that the public methods on HashedWheelTimeout be synchronized.
What do you think ?
-- Ron
http://sourceforge.net/projects/yajsw
--
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone
More information about the netty-users
mailing list