Fixed issue: NETTY-191 Raise ChannelClosedException only once when many queued write requests failed.

This commit is contained in:
Trustin Lee 2009-07-09 06:29:03 +00:00
parent 7c78539cd5
commit fecfadb853
2 changed files with 14 additions and 6 deletions

View File

@ -679,6 +679,7 @@ class NioDatagramWorker implements Runnable {
private static void cleanUpWriteBuffer(final NioDatagramChannel channel) {
Exception cause = null;
boolean fireExceptionCaught = false;
// Clean up the stale messages in the write buffer.
synchronized (channel.writeLock) {
@ -694,8 +695,7 @@ class NioDatagramWorker implements Runnable {
cause = new ClosedChannelException();
}
evt.getFuture().setFailure(cause);
fireExceptionCaught(channel, cause);
fireExceptionCaught = true;
}
Queue<MessageEvent> writeBuffer = channel.writeBufferQueue;
@ -716,10 +716,14 @@ class NioDatagramWorker implements Runnable {
break;
}
evt.getFuture().setFailure(cause);
fireExceptionCaught(channel, cause);
fireExceptionCaught = true;
}
}
}
if (fireExceptionCaught) {
fireExceptionCaught(channel, cause);
}
}
static void setInterestOps(final NioDatagramChannel channel,

View File

@ -593,6 +593,7 @@ class NioWorker implements Runnable {
private static void cleanUpWriteBuffer(NioSocketChannel channel) {
Exception cause = null;
boolean fireExceptionCaught = false;
// Clean up the stale messages in the write buffer.
synchronized (channel.writeLock) {
@ -609,8 +610,7 @@ class NioWorker implements Runnable {
cause = new ClosedChannelException();
}
evt.getFuture().setFailure(cause);
fireExceptionCaught(channel, cause);
fireExceptionCaught = true;
}
Queue<MessageEvent> writeBuffer = channel.writeBuffer;
@ -631,10 +631,14 @@ class NioWorker implements Runnable {
break;
}
evt.getFuture().setFailure(cause);
fireExceptionCaught(channel, cause);
fireExceptionCaught = true;
}
}
}
if (fireExceptionCaught) {
fireExceptionCaught(channel, cause);
}
}
static void setInterestOps(