Package io.netty.handler.ssl
Class SslHandlerCoalescingBufferQueue
- java.lang.Object
-
- io.netty.channel.AbstractCoalescingBufferQueue
-
- io.netty.handler.ssl.SslHandlerCoalescingBufferQueue
-
abstract class SslHandlerCoalescingBufferQueue extends AbstractCoalescingBufferQueue
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 ofwrapDataSize(). 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 Modifier and Type Field Description private booleanwantsDirectBuffer
-
Constructor Summary
Constructors Constructor Description SslHandlerCoalescingBufferQueue(Channel channel, int initSize, boolean wantsDirectBuffer)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static booleanattemptCopyToCumulation(ByteBuf cumulation, ByteBuf next, int wrapDataSize)protected ByteBufcompose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next)Calculate the result ofcurrent + next.protected ByteBufcomposeFirst(ByteBufAllocator allocator, ByteBuf first, int bufferSize)Calculate the firstByteBufwhich will be used in subsequent calls toAbstractCoalescingBufferQueue.compose(ByteBufAllocator, ByteBuf, ByteBuf).protected ByteBufremoveEmptyValue()The value to return whenAbstractCoalescingBufferQueue.remove(ByteBufAllocator, int, ChannelPromise)is called but the queue is empty.protected abstract intwrapDataSize()-
Methods inherited from class io.netty.channel.AbstractCoalescingBufferQueue
add, add, add, addFirst, composeFirst, composeIntoComposite, copyAndCompose, copyTo, isEmpty, readableBytes, releaseAndFailAll, remove, removeFirst, size, toString, writeAndRemoveAll
-
-
-
-
Constructor Detail
-
SslHandlerCoalescingBufferQueue
SslHandlerCoalescingBufferQueue(Channel channel, int initSize, boolean wantsDirectBuffer)
-
-
Method Detail
-
wrapDataSize
protected abstract int wrapDataSize()
-
compose
protected ByteBuf compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next)
Description copied from class:AbstractCoalescingBufferQueueCalculate the result ofcurrent + next.- Specified by:
composein classAbstractCoalescingBufferQueue
-
composeFirst
protected ByteBuf composeFirst(ByteBufAllocator allocator, ByteBuf first, int bufferSize)
Description copied from class:AbstractCoalescingBufferQueueCalculate the firstByteBufwhich will be used in subsequent calls toAbstractCoalescingBufferQueue.compose(ByteBufAllocator, ByteBuf, ByteBuf).- Overrides:
composeFirstin classAbstractCoalescingBufferQueuebufferSize- the optimal size of the buffer needed for cumulation- Returns:
- the first buffer
-
removeEmptyValue
protected ByteBuf removeEmptyValue()
Description copied from class:AbstractCoalescingBufferQueueThe value to return whenAbstractCoalescingBufferQueue.remove(ByteBufAllocator, int, ChannelPromise)is called but the queue is empty.- Specified by:
removeEmptyValuein classAbstractCoalescingBufferQueue- Returns:
- the
ByteBufwhich represents an empty queue.
-
-