Class NettyMessageClientDecoderDelegate

java.lang.Object
org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerAdapter
org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter
org.apache.flink.runtime.io.network.netty.NettyMessageClientDecoderDelegate
All Implemented Interfaces:
org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler, org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler

public class NettyMessageClientDecoderDelegate extends org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter
Decodes messages from the received netty buffers. This decoder assumes the messages have the following format: +-----------------------------------+--------------------------------+ | FRAME_HEADER || MESSAGE_HEADER | DATA BUFFER (Optional) | +-----------------------------------+--------------------------------+

This decoder decodes the frame header and delegates the following work to the corresponding message decoders according to the message type. During this process The frame header and message header are only accumulated if they span received multiple netty buffers, and the data buffer is copied directly to the buffer of corresponding input channel to avoid more copying.

The format of the frame header is +------------------+------------------+--------+ | FRAME LENGTH (4) | MAGIC NUMBER (4) | ID (1) | +------------------+------------------+--------+

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler

    org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler.Sharable
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelActive(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx)
     
    void
    channelInactive(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx)
    Releases resources when the channel is closed.
    void
    channelRead(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx, Object msg)
     

    Methods inherited from class org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter

    channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Method Details

    • channelActive

      public void channelActive(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelActive in interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelInactive

      public void channelInactive(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Releases resources when the channel is closed. When exceptions are thrown during processing received netty buffers, CreditBasedPartitionRequestClientHandler is expected to catch the exception and close the channel and trigger this notification.
      Specified by:
      channelInactive in interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter
      Parameters:
      ctx - The context of the channel close notification.
      Throws:
      Exception
    • channelRead

      public void channelRead(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
      Specified by:
      channelRead in interface org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception