402075 Cancel idle timeouts on close

This commit is contained in:
Greg Wilkins 2013-03-01 14:09:04 +11:00
parent 0ed3638660
commit 718ee4ddeb
2 changed files with 9 additions and 0 deletions

View File

@ -100,6 +100,7 @@ public abstract class AbstractEndPoint extends IdleTimeout implements EndPoint
@Override @Override
public void onClose() public void onClose()
{ {
super.onClose();
LOG.debug("onClose {}",this); LOG.debug("onClose {}",this);
_writeFlusher.onClose(); _writeFlusher.onClose();
_fillInterest.onClose(); _fillInterest.onClose();

View File

@ -95,6 +95,7 @@ public abstract class IdleTimeout
// If we have a new timeout, then check and reschedule // If we have a new timeout, then check and reschedule
if (idleTimeout>0 && isOpen()) if (idleTimeout>0 && isOpen())
_idleTask.run(); _idleTask.run();
} }
/** This method should be called when non-idle activity has taken place. /** This method should be called when non-idle activity has taken place.
@ -120,6 +121,13 @@ public abstract class IdleTimeout
_idleTask.run(); _idleTask.run();
} }
public void onClose()
{
Scheduler.Task oldTimeout = _timeout.getAndSet(null);
if (oldTimeout != null)
oldTimeout.cancel();
}
protected void close() protected void close()
{ {
Scheduler.Task oldTimeout = _timeout.getAndSet(null); Scheduler.Task oldTimeout = _timeout.getAndSet(null);