Home / Class/ MyMessageProcessor Class — netty Architecture

MyMessageProcessor Class — netty Architecture

Architecture documentation for the MyMessageProcessor class in NativeDatagramPacketArray.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  29eec517_22bd_4136_2a86_329d0d4bea68["MyMessageProcessor"]
  b2cbda6d_cb9e_3f7b_72f8_26519849d735["NativeDatagramPacketArray.java"]
  29eec517_22bd_4136_2a86_329d0d4bea68 -->|defined in| b2cbda6d_cb9e_3f7b_72f8_26519849d735
  9eecdd2f_216f_e7dc_b481_6ba488dff4af["processMessage()"]
  29eec517_22bd_4136_2a86_329d0d4bea68 -->|method| 9eecdd2f_216f_e7dc_b481_6ba488dff4af

Relationship Graph

Source Code

transport-classes-epoll/src/main/java/io/netty/channel/epoll/NativeDatagramPacketArray.java lines 113–145

    private final class MyMessageProcessor implements MessageProcessor {
        private boolean connected;
        private int maxMessagesPerWrite;

        @Override
        public boolean processMessage(Object msg) {
            final boolean added;
            if (msg instanceof DatagramPacket) {
                DatagramPacket packet = (DatagramPacket) msg;
                ByteBuf buf = packet.content();
                int segmentSize = 0;
                if (packet instanceof io.netty.channel.unix.SegmentedDatagramPacket) {
                    int seg = ((io.netty.channel.unix.SegmentedDatagramPacket) packet).segmentSize();
                    // We only need to tell the kernel that we want to use UDP_SEGMENT if there are multiple
                    // segments in the packet.
                    if (buf.readableBytes() > seg) {
                        segmentSize = seg;
                    }
                }
                added = add0(buf, buf.readerIndex(), buf.readableBytes(), segmentSize, packet.recipient());
            } else if (msg instanceof ByteBuf && connected) {
                ByteBuf buf = (ByteBuf) msg;
                added = add0(buf, buf.readerIndex(), buf.readableBytes(), 0, null);
            } else {
                added = false;
            }
            if (added) {
                maxMessagesPerWrite--;
                return maxMessagesPerWrite > 0;
            }
            return false;
        }
    }

Frequently Asked Questions

What is the MyMessageProcessor class?
MyMessageProcessor is a class in the netty codebase, defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/NativeDatagramPacketArray.java.
Where is MyMessageProcessor defined?
MyMessageProcessor is defined in transport-classes-epoll/src/main/java/io/netty/channel/epoll/NativeDatagramPacketArray.java at line 113.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free