Fixed issue: NETTY-224 CancelledKeyException on Channel.setReadable() in NIO transport

* Handled CancelledKeyException properly
This commit is contained in:
Trustin Lee 2009-09-04 02:14:06 +00:00
parent edd056d3de
commit 8a0f8e9d78
2 changed files with 10 additions and 0 deletions

View File

@ -803,6 +803,11 @@ class NioDatagramWorker implements Runnable {
channel.setRawInterestOpsNow(interestOps);
fireChannelInterestChanged(channel);
}
} catch (final CancelledKeyException e) {
// setInterestOps() was called on a closed channel.
ClosedChannelException cce = new ClosedChannelException();
future.setFailure(cce);
fireExceptionCaught(channel, cce);
} catch (final Throwable t) {
future.setFailure(t);
fireExceptionCaught(channel, t);

View File

@ -711,6 +711,11 @@ class NioWorker implements Runnable {
channel.setRawInterestOpsNow(interestOps);
fireChannelInterestChanged(channel);
}
} catch (CancelledKeyException e) {
// setInterestOps() was called on a closed channel.
ClosedChannelException cce = new ClosedChannelException();
future.setFailure(cce);
fireExceptionCaught(channel, cce);
} catch (Throwable t) {
future.setFailure(t);
fireExceptionCaught(channel, t);