buffer.discardReadBytes() should not be called too often

This commit is contained in:
Trustin Lee 2008-12-08 10:07:06 +00:00
parent 6e08f03589
commit 18e745e2a1

View File

@ -108,13 +108,13 @@ public class CompatibleObjectEncoder implements ChannelDownstreamHandler {
writtenObjects ++; writtenObjects ++;
if (writtenObjects % resetInterval == 0) { if (writtenObjects % resetInterval == 0) {
oout.reset(); oout.reset();
buffer.discardReadBytes();
} }
} }
oout.writeObject(e.getMessage()); oout.writeObject(e.getMessage());
oout.flush(); oout.flush();
ChannelBuffer encoded = buffer.readBytes(buffer.readableBytes()); ChannelBuffer encoded = buffer.readBytes(buffer.readableBytes());
buffer.discardReadBytes();
write(context, e.getChannel(), e.getFuture(), encoded, e.getRemoteAddress()); write(context, e.getChannel(), e.getFuture(), encoded, e.getRemoteAddress());
} }