Replaced SslHandler.pendingEncryptedWrites with the thread-safe one

This commit is contained in:
Trustin Lee 2010-06-16 03:12:00 +00:00
parent f2d490ef9f
commit f753dc2b83

View File

@ -50,6 +50,7 @@ import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.handler.codec.frame.FrameDecoder; import org.jboss.netty.handler.codec.frame.FrameDecoder;
import org.jboss.netty.logging.InternalLogger; import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.util.internal.LinkedTransferQueue;
import org.jboss.netty.util.internal.NonReentrantLock; import org.jboss.netty.util.internal.NonReentrantLock;
/** /**
@ -184,7 +185,7 @@ public class SslHandler extends FrameDecoder
int ignoreClosedChannelException; int ignoreClosedChannelException;
final Object ignoreClosedChannelExceptionLock = new Object(); final Object ignoreClosedChannelExceptionLock = new Object();
private final Queue<PendingWrite> pendingUnencryptedWrites = new LinkedList<PendingWrite>(); private final Queue<PendingWrite> pendingUnencryptedWrites = new LinkedList<PendingWrite>();
private final Queue<MessageEvent> pendingEncryptedWrites = new LinkedList<MessageEvent>(); private final Queue<MessageEvent> pendingEncryptedWrites = new LinkedTransferQueue<MessageEvent>();
private final NonReentrantLock pendingEncryptedWritesLock = new NonReentrantLock(); private final NonReentrantLock pendingEncryptedWritesLock = new NonReentrantLock();
/** /**
@ -761,10 +762,6 @@ public class SslHandler extends FrameDecoder
} }
try { try {
if (pendingEncryptedWrites.isEmpty()) {
return;
}
MessageEvent e; MessageEvent e;
while ((e = pendingEncryptedWrites.poll()) != null) { while ((e = pendingEncryptedWrites.poll()) != null) {
ctx.sendDownstream(e); ctx.sendDownstream(e);