diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java index 81e22ab99c..afb5b9baaf 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java @@ -179,11 +179,13 @@ import org.jboss.netty.handler.codec.replay.ReplayingDecoder; */ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler implements LifeCycleAwareChannelHandler { + public static final int DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS = 1000; + private boolean unfold; protected ChannelBuffer cumulation; private volatile ChannelHandlerContext ctx; private int copyThreshold; - private int maxCumulationBufferComponents = 4; + private int maxCumulationBufferComponents = DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS; protected FrameDecoder() { this(false); @@ -252,7 +254,7 @@ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler implemen * Returns the maximum number of components in the cumulation buffer. If the number of * the components in the cumulation buffer exceeds this value, the components of the * cumulation buffer are consolidated into a single component, involving memory copies. - * The default value of this property is {@code 4}. + * The default value of this property {@link #DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS}. */ public final int getMaxCumulationBufferComponents() { return maxCumulationBufferComponents; @@ -262,7 +264,8 @@ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler implemen * Sets the maximum number of components in the cumulation buffer. If the number of * the components in the cumulation buffer exceeds this value, the components of the * cumulation buffer are consolidated into a single component, involving memory copies. - * The default value of this property is {@code 4} and its minimum allowed value is {@code 2}. + * The default value of this property is {@link #DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS} + * and its minimum allowed value is {@code 2}. */ public final void setMaxCumulationBufferComponents(int maxCumulationBufferComponents) { if (maxCumulationBufferComponents < 2) { diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingDecoder.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingDecoder.java index 1bbbc8bb5f..4901666607 100644 --- a/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/CompatibleMarshallingDecoder.java @@ -55,7 +55,6 @@ public class CompatibleMarshallingDecoder extends ReplayingDecoder { public CompatibleMarshallingDecoder(UnmarshallerProvider provider, int maxObjectSize) { this.provider = provider; this.maxObjectSize = maxObjectSize; - setMaxCumulationBufferComponents(Integer.MAX_VALUE); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingDecoder.java b/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingDecoder.java index c5b212cc2f..f4a55a39f8 100644 --- a/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/marshalling/MarshallingDecoder.java @@ -57,7 +57,6 @@ public class MarshallingDecoder extends LengthFieldBasedFrameDecoder { public MarshallingDecoder(UnmarshallerProvider provider, int maxObjectSize) { super(maxObjectSize, 0, 4, 0, 4); this.provider = provider; - setMaxCumulationBufferComponents(Integer.MAX_VALUE); } diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoder.java index 46733f1fe4..8afa62e1e6 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoder.java @@ -61,7 +61,6 @@ public class CompatibleObjectDecoder extends ReplayingDecoder