Only create UnsafeDynamicChannelBuffer if really needed. See #108

This commit is contained in:
norman 2011-12-08 14:36:46 +01:00
parent 3b368125b0
commit 081395410d

View File

@ -567,9 +567,10 @@ public abstract class ReplayingDecoder<T extends Enum<T>>
private ChannelBuffer cumulation(ChannelHandlerContext ctx) {
ChannelBuffer buf = this.cumulation;
if (buf == null) {
ChannelBufferFactory factory = ctx.getChannel().getConfig().getBufferFactory();
buf = new UnsafeDynamicChannelBuffer(factory);
if (cumulation == null) {
ChannelBufferFactory factory = ctx.getChannel().getConfig().getBufferFactory();
buf = new UnsafeDynamicChannelBuffer(factory);
cumulation = buf;
replayable = new ReplayingDecoderBuffer(buf);
} else {