buffer.discardReadBytes() should not be called too often
This commit is contained in:
parent
6e08f03589
commit
18e745e2a1
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user