Package org.apache.cassandra.net
Class InboundMessageHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
org.apache.cassandra.net.AbstractMessageHandler
org.apache.cassandra.net.InboundMessageHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,FrameDecoder.FrameProcessor
Implementation of
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.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.cassandra.net.AbstractMessageHandler
AbstractMessageHandler.OnHandlerClosed, AbstractMessageHandler.WaitQueueNested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
Fields inherited from class org.apache.cassandra.net.AbstractMessageHandler
channel, corruptFramesRecovered, corruptFramesUnrecovered, decoder, endpointReserveCapacity, endpointWaitQueue, globalReserveCapacity, globalWaitQueue, largeMessage, largeThreshold, onClosed, queueCapacity, receivedBytes, receivedCount, throttledCount, throttledNanos -
Method Summary
Modifier and TypeMethodDescriptionvoidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) protected voidfatalExceptionCaught(Throwable cause) protected Stringid()protected voidprotected booleanprocessFirstFrameOfLargeMessage(FrameDecoder.IntactFrame frame, ResourceLimits.Limit endpointReserve, ResourceLimits.Limit globalReserve) protected booleanprocessOneContainedMessage(ShareableBytes bytes, ResourceLimits.Limit endpointReserve, ResourceLimits.Limit globalReserve) toString()Methods inherited from class org.apache.cassandra.net.AbstractMessageHandler
acquireCapacity, acquireCapacity, channelInactive, channelRead, handlerAdded, process, processSubsequentFrameOfLargeMessage, processUpToOneMessage, releaseCapacity, releaseProcessedCapacityMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerRemoved
-
Method Details
-
processFirstFrameOfLargeMessage
protected boolean processFirstFrameOfLargeMessage(FrameDecoder.IntactFrame frame, ResourceLimits.Limit endpointReserve, ResourceLimits.Limit globalReserve) throws IOException - Specified by:
processFirstFrameOfLargeMessagein classAbstractMessageHandler- Throws:
IOException
-
processCorruptFrame
- Specified by:
processCorruptFramein classAbstractMessageHandler- Throws:
Crc.InvalidCrc
-
id
- Specified by:
idin classAbstractMessageHandler
-
toString
-
exceptionCaught
- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-
fatalExceptionCaught
- Specified by:
fatalExceptionCaughtin classAbstractMessageHandler