CoalescingBufferQueue Class — netty Architecture
Architecture documentation for the CoalescingBufferQueue class in CoalescingBufferQueue.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 450c59cb_dedc_05cc_fb1e_5ba7712b2ae5["CoalescingBufferQueue"] 06e826c9_ef79_4212_c593_4aca3c9a9b5e["CoalescingBufferQueue.java"] 450c59cb_dedc_05cc_fb1e_5ba7712b2ae5 -->|defined in| 06e826c9_ef79_4212_c593_4aca3c9a9b5e 3cd7b2c9_79a5_5fbd_a715_c346eda23c48["CoalescingBufferQueue()"] 450c59cb_dedc_05cc_fb1e_5ba7712b2ae5 -->|method| 3cd7b2c9_79a5_5fbd_a715_c346eda23c48 7414fe55_127e_c3d8_df0d_6d57aaa3779b["ByteBuf()"] 450c59cb_dedc_05cc_fb1e_5ba7712b2ae5 -->|method| 7414fe55_127e_c3d8_df0d_6d57aaa3779b 88453810_f5e0_4447_aa90_d680db6b623d["releaseAndFailAll()"] 450c59cb_dedc_05cc_fb1e_5ba7712b2ae5 -->|method| 88453810_f5e0_4447_aa90_d680db6b623d
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/CoalescingBufferQueue.java lines 35–86
public final class CoalescingBufferQueue extends AbstractCoalescingBufferQueue {
private final Channel channel;
public CoalescingBufferQueue(Channel channel) {
this(channel, 4);
}
public CoalescingBufferQueue(Channel channel, int initSize) {
this(channel, initSize, false);
}
public CoalescingBufferQueue(Channel channel, int initSize, boolean updateWritability) {
super(updateWritability ? channel : null, initSize);
this.channel = ObjectUtil.checkNotNull(channel, "channel");
}
/**
* Remove a {@link ByteBuf} from the queue with the specified number of bytes. Any added buffer who's bytes are
* fully consumed during removal will have it's promise completed when the passed aggregate {@link ChannelPromise}
* completes.
*
* @param bytes the maximum number of readable bytes in the returned {@link ByteBuf}, if {@code bytes} is greater
* than {@link #readableBytes} then a buffer of length {@link #readableBytes} is returned.
* @param aggregatePromise used to aggregate the promises and listeners for the constituent buffers.
* @return a {@link ByteBuf} composed of the enqueued buffers.
*/
public ByteBuf remove(int bytes, ChannelPromise aggregatePromise) {
return remove(channel.alloc(), bytes, aggregatePromise);
}
/**
* Release all buffers in the queue and complete all listeners and promises.
*/
public void releaseAndFailAll(Throwable cause) {
releaseAndFailAll(channel, cause);
}
@Override
protected ByteBuf compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) {
if (cumulation instanceof CompositeByteBuf) {
CompositeByteBuf composite = (CompositeByteBuf) cumulation;
composite.addComponent(true, next);
return composite;
}
return composeIntoComposite(alloc, cumulation, next);
}
@Override
protected ByteBuf removeEmptyValue() {
return Unpooled.EMPTY_BUFFER;
}
}
Source
Frequently Asked Questions
What is the CoalescingBufferQueue class?
CoalescingBufferQueue is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/CoalescingBufferQueue.java.
Where is CoalescingBufferQueue defined?
CoalescingBufferQueue is defined in transport/src/main/java/io/netty/channel/CoalescingBufferQueue.java at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free