Home / Class/ MsgEchoPeerBase Class — netty Architecture

MsgEchoPeerBase Class — netty Architecture

Architecture documentation for the MsgEchoPeerBase class in MsgEchoPeerBase.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d0ce01df_1bcc_da19_1b31_1f7034da24e0["MsgEchoPeerBase"]
  b9c8f265_7295_f1d6_ae24_e9ed3380aea8["MsgEchoPeerBase.java"]
  d0ce01df_1bcc_da19_1b31_1f7034da24e0 -->|defined in| b9c8f265_7295_f1d6_ae24_e9ed3380aea8
  b15e1b2e_167f_4f9c_0f28_b86388168fde["MsgEchoPeerBase()"]
  d0ce01df_1bcc_da19_1b31_1f7034da24e0 -->|method| b15e1b2e_167f_4f9c_0f28_b86388168fde
  772bff63_778a_5822_e434_0b19d0126caf["run()"]
  d0ce01df_1bcc_da19_1b31_1f7034da24e0 -->|method| 772bff63_778a_5822_e434_0b19d0126caf

Relationship Graph

Source Code

example/src/main/java/io/netty/example/udt/echo/rendezvous/MsgEchoPeerBase.java lines 39–78

public abstract class MsgEchoPeerBase {

    protected final int messageSize;
    protected final InetSocketAddress self;
    protected final InetSocketAddress peer;

    protected MsgEchoPeerBase(final InetSocketAddress self, final InetSocketAddress peer, final int messageSize) {
        this.messageSize = messageSize;
        this.self = self;
        this.peer = peer;
    }

    public void run() throws Exception {
        // Configure the peer.
        final ThreadFactory connectFactory = new DefaultThreadFactory("rendezvous");
        final EventLoopGroup connectGroup = new MultiThreadIoEventLoopGroup(1,
                connectFactory, NioIoHandler.newFactory(NioUdtProvider.MESSAGE_PROVIDER));
        try {
            final Bootstrap boot = new Bootstrap();
            boot.group(connectGroup)
                    .channelFactory(NioUdtProvider.MESSAGE_RENDEZVOUS)
                    .handler(new ChannelInitializer<UdtChannel>() {
                        @Override
                        public void initChannel(final UdtChannel ch)
                                throws Exception {
                            ch.pipeline().addLast(
                                    new LoggingHandler(LogLevel.INFO),
                                    new MsgEchoPeerHandler(messageSize));
                        }
                    });
            // Start the peer.
            final ChannelFuture f = boot.connect(peer, self).sync();
            // Wait until the connection is closed.
            f.channel().closeFuture().sync();
        } finally {
            // Shut down the event loop to terminate all threads.
            connectGroup.shutdownGracefully();
        }
    }
}

Frequently Asked Questions

What is the MsgEchoPeerBase class?
MsgEchoPeerBase is a class in the netty codebase, defined in example/src/main/java/io/netty/example/udt/echo/rendezvous/MsgEchoPeerBase.java.
Where is MsgEchoPeerBase defined?
MsgEchoPeerBase is defined in example/src/main/java/io/netty/example/udt/echo/rendezvous/MsgEchoPeerBase.java at line 39.

Analyze Your Own Codebase

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

Try Supermodel Free