ByteBuf and consumers take bytes in
arbitrary lengths. This allows producers to add lots of small buffers and the consumer to take all the bytes
out in a single buffer. Conversely the producer may add larger buffers and the consumer could take the bytes in
many small buffers.
Bytes are added and removed with promises. If the last byte of a buffer added with a promise is removed then
that promise will complete when the promise passed to remove completes.
This functionality is useful for aggregating or partitioning writes into fixed size buffers for framing protocols such as HTTP2.
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected ByteBuf | compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next)
Implements abstract io. current + next.
|
| public void | releaseAndFailAll(Throwable cause)
Release all buffers in the queue and complete all listeners and promises. |
| public ByteBuf | Returns: aByteBuf composed of the enqueued buffers.the maximum number of readable bytes in the returned bytes, ChannelPromise ByteBuf, if bytes is greater
than readableBytes then a buffer of length readableBytes is returned.used to aggregate the promises and listeners for the constituent buffers. aggregatePromise)Remove a |
| protected ByteBuf | removeEmptyValue()
Implements abstract io. remove(ByteBufAllocator, int, ChannelPromise) is called but the queue is empty.
|
| channel | back to summary |
|---|---|
| private final Channel channel | |
| CoalescingBufferQueue | back to summary |
|---|---|
| public CoalescingBufferQueue(Channel channel) | |
| CoalescingBufferQueue | back to summary |
|---|---|
| public CoalescingBufferQueue(Channel channel, int initSize) | |
| CoalescingBufferQueue | back to summary |
|---|---|
| public CoalescingBufferQueue(Channel channel, int initSize, boolean updateWritability) | |
| compose | back to summary |
|---|---|
| protected ByteBuf compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) Implements abstract io. Doc from io. Calculate the result of
| |
| releaseAndFailAll | back to summary |
|---|---|
| public void releaseAndFailAll(Throwable cause) Release all buffers in the queue and complete all listeners and promises. | |
| remove | back to summary |
|---|---|
| public ByteBuf remove(int bytes, ChannelPromise aggregatePromise) Remove a
| |
| removeEmptyValue | back to summary |
|---|---|
| protected ByteBuf removeEmptyValue() Implements abstract io. Doc from io. The value to return when | |