From 081395410d7c96a0c6cb70f9e74bb275a0d7022a Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 8 Dec 2011 14:36:46 +0100 Subject: [PATCH] Only create UnsafeDynamicChannelBuffer if really needed. See #108 --- .../jboss/netty/handler/codec/replay/ReplayingDecoder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java index 13ceb5aecf..6ebf88a084 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java @@ -567,9 +567,10 @@ public abstract class ReplayingDecoder> 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 {