Determine CompositeByteBuf implementation by using ByteBufAllocator
Motivation: Currently, using a MessageAggregator in the pipeline always results in the creation of an unpooled heap CompositeByteBuf. By using the ByteBufAllocator the CompositeByteBuf will use the implementation specified by the ByteBufAllocator. Modifications: Use the ChannelHandlerContext's ByteBufAllocator to create the CompositeByteBuf for message aggregation Result: The CompositeByteBuf is now configured based on the ByteBufAllocator's settings.
This commit is contained in:
parent
7a3d91f43d
commit
aa8917115c
@ -238,7 +238,7 @@ public abstract class MessageAggregator<I, S, C extends ByteBufHolder, O extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A streamed message - initialize the cumulative buffer, and wait for incoming chunks.
|
// A streamed message - initialize the cumulative buffer, and wait for incoming chunks.
|
||||||
CompositeByteBuf content = Unpooled.compositeBuffer(maxCumulationBufferComponents);
|
CompositeByteBuf content = ctx.alloc().compositeBuffer(maxCumulationBufferComponents);
|
||||||
if (m instanceof ByteBufHolder) {
|
if (m instanceof ByteBufHolder) {
|
||||||
appendPartialContent(content, ((ByteBufHolder) m).content());
|
appendPartialContent(content, ((ByteBufHolder) m).content());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user