Add the factory to create the buffer

This commit is contained in:
norman 2012-04-24 13:01:49 +02:00
parent bfeb9ffd9a
commit c9da4931c7
3 changed files with 4 additions and 6 deletions

View File

@ -78,8 +78,8 @@ public class FixedLengthFrameDecoder extends FrameDecoder {
protected ChannelBuffer newCumulationBuffer(ChannelHandlerContext ctx, int minimumCapacity) { protected ChannelBuffer newCumulationBuffer(ChannelHandlerContext ctx, int minimumCapacity) {
ChannelBufferFactory factory = ctx.getChannel().getConfig().getBufferFactory(); ChannelBufferFactory factory = ctx.getChannel().getConfig().getBufferFactory();
if (allocateFullBuffer) { if (allocateFullBuffer) {
return ChannelBuffers.buffer( return factory.getBuffer(frameLength);
factory.getDefaultOrder(), frameLength);
} }
return super.newCumulationBuffer(ctx, minimumCapacity); return super.newCumulationBuffer(ctx, minimumCapacity);
} }

View File

@ -390,7 +390,6 @@ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler {
protected ChannelBuffer newCumulationBuffer( protected ChannelBuffer newCumulationBuffer(
ChannelHandlerContext ctx, int minimumCapacity) { ChannelHandlerContext ctx, int minimumCapacity) {
ChannelBufferFactory factory = ctx.getChannel().getConfig().getBufferFactory(); ChannelBufferFactory factory = ctx.getChannel().getConfig().getBufferFactory();
return ChannelBuffers.buffer( return factory.getBuffer(Math.max(minimumCapacity, 256));
factory.getDefaultOrder(), Math.max(minimumCapacity, 256));
} }
} }

View File

@ -647,7 +647,6 @@ public abstract class ReplayingDecoder<T extends Enum<T>>
protected ChannelBuffer newCumulationBuffer( protected ChannelBuffer newCumulationBuffer(
ChannelHandlerContext ctx, int minimumCapacity) { ChannelHandlerContext ctx, int minimumCapacity) {
ChannelBufferFactory factory = ctx.getChannel().getConfig().getBufferFactory(); ChannelBufferFactory factory = ctx.getChannel().getConfig().getBufferFactory();
return ChannelBuffers.buffer( return factory.getBuffer(Math.max(minimumCapacity, 256));
factory.getDefaultOrder(), Math.max(minimumCapacity, 256));
} }
} }