Only create UnsafeDynamicChannelBuffer if really needed. See #108

This commit is contained in:
norman 2011-12-08 14:34:30 +01:00
parent 229c8734ed
commit 7d9879d5cc

View File

@ -565,9 +565,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 {