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
public class InboundMessageHandler extends AbstractMessageHandler
Implementation ofAbstractMessageHandlerfor 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,InboundMessageHandlerimplements a strict flow control policy. The size of the incoming message is dependent on the messaging version of the specific peer connection. SeeMessage.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 theStagefor theVerbof the message.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.cassandra.net.AbstractMessageHandler
AbstractMessageHandler.OnHandlerClosed, AbstractMessageHandler.WaitQueue
-
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause)protected voidfatalExceptionCaught(java.lang.Throwable cause)protected java.lang.Stringid()protected voidprocessCorruptFrame(FrameDecoder.CorruptFrame frame)protected booleanprocessFirstFrameOfLargeMessage(FrameDecoder.IntactFrame frame, ResourceLimits.Limit endpointReserve, ResourceLimits.Limit globalReserve)protected booleanprocessOneContainedMessage(ShareableBytes bytes, ResourceLimits.Limit endpointReserve, ResourceLimits.Limit globalReserve)java.lang.StringtoString()-
Methods inherited from class org.apache.cassandra.net.AbstractMessageHandler
acquireCapacity, acquireCapacity, channelInactive, channelRead, handlerAdded, process, processSubsequentFrameOfLargeMessage, processUpToOneMessage, releaseCapacity, releaseProcessedCapacity
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharable
-
-
-
-
Method Detail
-
processOneContainedMessage
protected boolean processOneContainedMessage(ShareableBytes bytes, ResourceLimits.Limit endpointReserve, ResourceLimits.Limit globalReserve) throws java.io.IOException
- Specified by:
processOneContainedMessagein classAbstractMessageHandler- Throws:
java.io.IOException
-
processFirstFrameOfLargeMessage
protected boolean processFirstFrameOfLargeMessage(FrameDecoder.IntactFrame frame, ResourceLimits.Limit endpointReserve, ResourceLimits.Limit globalReserve) throws java.io.IOException
- Specified by:
processFirstFrameOfLargeMessagein classAbstractMessageHandler- Throws:
java.io.IOException
-
processCorruptFrame
protected void processCorruptFrame(FrameDecoder.CorruptFrame frame) throws Crc.InvalidCrc
- Specified by:
processCorruptFramein classAbstractMessageHandler- Throws:
Crc.InvalidCrc
-
id
protected java.lang.String id()
- Specified by:
idin classAbstractMessageHandler
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause)- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-
fatalExceptionCaught
protected void fatalExceptionCaught(java.lang.Throwable cause)
- Specified by:
fatalExceptionCaughtin classAbstractMessageHandler
-
-