Package org.mockserver.netty.unification
Class PacedLargeWriteHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
io.netty.handler.stream.ChunkedWriteHandler
org.mockserver.netty.unification.PacedLargeWriteHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public class PacedLargeWriteHandler
extends io.netty.handler.stream.ChunkedWriteHandler
Sends a large encoded HTTP/1.1 message to the socket in slices, writing the next slice only while the
connection is writable. A slow reader then holds about one slice plus the connection's write-buffer
high-water mark of outbound data, instead of the whole body: the transport copies a heap body into
direct memory as it is written, so without this every slow reader pins a direct copy of its response.
It sits on the socket side of HttpServerCodec and sees encoded bytes, so the bytes on the wire
are unchanged and anything written after a paced body - including raw bytes written from the codec's
context - queues behind it in order. Only buffers written while the codec is in the pipeline are paced:
after a WebSocket upgrade removes it, frames pass straight into the outbound buffer, where the WebSocket
relay's writability-based backpressure can see them.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class io.netty.handler.stream.ChunkedWriteHandler
channelInactive, channelWritabilityChanged, flush, handlerAdded, handlerRemoved, resumeTransferMethods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, readMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Constructor Details
-
PacedLargeWriteHandler
public PacedLargeWriteHandler()
-
-
Method Details