public class InboundMessageHandler extends AbstractMessageHandler
AbstractMessageHandler for processing internode messages from peers.
# Small vs large messages
Small messages are deserialized in place, and then handed off to an appropriate
thread pool for processing. Large messages accumulate frames until completion of a message, then hand off
the untouched frames to the correct thread pool for the verb to be deserialized there and immediately processed.
# Flow control (backpressure)
To prevent nodes from overwhelming and bringing each other to the knees with more inbound messages that
can be processed in a timely manner, InboundMessageHandler implements a strict flow control policy.
The size of the incoming message is dependent on the messaging version of the specific peer connection. See
Message.Serializer.inferMessageSize(ByteBuffer, int, int, int).
By default, every connection has 4MiB of exlusive permits available before needing to access the per-endpoint
and global reserves.
Permits are released after the verb handler has been invoked on the Stage for the Verb of the message.AbstractMessageHandler.OnHandlerClosed, AbstractMessageHandler.WaitQueuechannel, corruptFramesRecovered, corruptFramesUnrecovered, decoder, endpointReserveCapacity, endpointWaitQueue, globalReserveCapacity, globalWaitQueue, largeMessage, largeThreshold, onClosed, queueCapacity, receivedBytes, receivedCount, throttledCount, throttledNanos| Modifier and Type | Method and Description |
|---|---|
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Throwable cause) |
protected void |
fatalExceptionCaught(java.lang.Throwable cause) |
protected java.lang.String |
id() |
protected void |
processCorruptFrame(FrameDecoder.CorruptFrame frame) |
protected boolean |
processFirstFrameOfLargeMessage(FrameDecoder.IntactFrame frame,
ResourceLimits.Limit endpointReserve,
ResourceLimits.Limit globalReserve) |
protected boolean |
processOneContainedMessage(ShareableBytes bytes,
ResourceLimits.Limit endpointReserve,
ResourceLimits.Limit globalReserve) |
java.lang.String |
toString() |
acquireCapacity, acquireCapacity, channelInactive, channelRead, handlerAdded, process, processSubsequentFrameOfLargeMessage, releaseCapacity, releaseProcessedCapacitychannelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredensureNotSharable, handlerRemoved, isSharableprotected boolean processOneContainedMessage(ShareableBytes bytes, ResourceLimits.Limit endpointReserve, ResourceLimits.Limit globalReserve) throws java.io.IOException
processOneContainedMessage in class AbstractMessageHandlerjava.io.IOExceptionprotected boolean processFirstFrameOfLargeMessage(FrameDecoder.IntactFrame frame, ResourceLimits.Limit endpointReserve, ResourceLimits.Limit globalReserve) throws java.io.IOException
processFirstFrameOfLargeMessage in class AbstractMessageHandlerjava.io.IOExceptionprotected void processCorruptFrame(FrameDecoder.CorruptFrame frame) throws Crc.InvalidCrc
processCorruptFrame in class AbstractMessageHandlerCrc.InvalidCrcprotected java.lang.String id()
id in class AbstractMessageHandlerpublic java.lang.String toString()
toString in class java.lang.Objectpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Throwable cause)
exceptionCaught in interface io.netty.channel.ChannelHandlerexceptionCaught in interface io.netty.channel.ChannelInboundHandlerexceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapterprotected void fatalExceptionCaught(java.lang.Throwable cause)
fatalExceptionCaught in class AbstractMessageHandlerCopyright © 2009-2022 The Apache Software Foundation