Package io.netty.handler.ssl
Class SslHandlerCoalescingBufferQueue
java.lang.Object
io.netty.channel.AbstractCoalescingBufferQueue
io.netty.handler.ssl.SslHandlerCoalescingBufferQueue
Each call to SSL_write will introduce about ~100 bytes of overhead. This coalescing queue attempts to increase
goodput by aggregating the plaintext in chunks of
wrapDataSize()
. If many small chunks are written
this can increase goodput, decrease the amount of calls to SSL_write, and decrease overall encryption operations.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSslHandlerCoalescingBufferQueue
(Channel channel, int initSize, boolean wantsDirectBuffer) -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
attemptCopyToCumulation
(ByteBuf cumulation, ByteBuf next, int wrapDataSize) protected ByteBuf
compose
(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) Calculate the result ofcurrent + next
.protected ByteBuf
composeFirst
(ByteBufAllocator allocator, ByteBuf first, int bufferSize) Calculate the firstByteBuf
which will be used in subsequent calls toAbstractCoalescingBufferQueue.compose(ByteBufAllocator, ByteBuf, ByteBuf)
.protected ByteBuf
The value to return whenAbstractCoalescingBufferQueue.remove(ByteBufAllocator, int, ChannelPromise)
is called but the queue is empty.protected abstract int
Methods inherited from class io.netty.channel.AbstractCoalescingBufferQueue
add, add, add, addFirst, composeFirst, composeIntoComposite, copyAndCompose, copyTo, isEmpty, readableBytes, releaseAndFailAll, remove, removeFirst, size, toString, writeAndRemoveAll
-
Field Details
-
wantsDirectBuffer
private final boolean wantsDirectBuffer
-
-
Constructor Details
-
SslHandlerCoalescingBufferQueue
SslHandlerCoalescingBufferQueue(Channel channel, int initSize, boolean wantsDirectBuffer)
-
-
Method Details
-
wrapDataSize
protected abstract int wrapDataSize() -
compose
Description copied from class:AbstractCoalescingBufferQueue
Calculate the result ofcurrent + next
.- Specified by:
compose
in classAbstractCoalescingBufferQueue
-
composeFirst
Description copied from class:AbstractCoalescingBufferQueue
Calculate the firstByteBuf
which will be used in subsequent calls toAbstractCoalescingBufferQueue.compose(ByteBufAllocator, ByteBuf, ByteBuf)
.- Overrides:
composeFirst
in classAbstractCoalescingBufferQueue
- Parameters:
bufferSize
- the optimal size of the buffer needed for cumulation- Returns:
- the first buffer
-
removeEmptyValue
Description copied from class:AbstractCoalescingBufferQueue
The value to return whenAbstractCoalescingBufferQueue.remove(ByteBufAllocator, int, ChannelPromise)
is called but the queue is empty.- Specified by:
removeEmptyValue
in classAbstractCoalescingBufferQueue
- Returns:
- the
ByteBuf
which represents an empty queue.
-
attemptCopyToCumulation
-