Home / Class/ MsgEchoServer Class — netty Architecture

MsgEchoServer Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  c9781103_8a22_68ef_c231_fe14475e7a3c["MsgEchoServer"]
  42c0f57d_37b4_b454_0686_79f7f305d117["MsgEchoServer.java"]
  c9781103_8a22_68ef_c231_fe14475e7a3c -->|defined in| 42c0f57d_37b4_b454_0686_79f7f305d117
  a2199479_520e_5da5_174a_7ead7f6d3ac5["main()"]
  c9781103_8a22_68ef_c231_fe14475e7a3c -->|method| a2199479_520e_5da5_174a_7ead7f6d3ac5

Relationship Graph

Source Code

example/src/main/java/io/netty/example/udt/echo/message/MsgEchoServer.java lines 38–73

public final class MsgEchoServer {

    static final int PORT = Integer.parseInt(System.getProperty("port", "8007"));

    public static void main(String[] args) throws Exception {
        final ThreadFactory factory = new DefaultThreadFactory("udt");
        final EventLoopGroup group =
                new MultiThreadIoEventLoopGroup(
                        1, factory, NioIoHandler.newFactory(NioUdtProvider.MESSAGE_PROVIDER));

        // Configure the server.
        try {
            final ServerBootstrap boot = new ServerBootstrap();
            boot.group(group)
                    .channelFactory(NioUdtProvider.MESSAGE_ACCEPTOR)
                    .option(ChannelOption.SO_BACKLOG, 10)
                    .handler(new LoggingHandler(LogLevel.INFO))
                    .childHandler(new ChannelInitializer<UdtChannel>() {
                        @Override
                        public void initChannel(final UdtChannel ch)
                                throws Exception {
                            ch.pipeline().addLast(
                                    new LoggingHandler(LogLevel.INFO),
                                    new MsgEchoServerHandler());
                        }
                    });
            // Start the server.
            final ChannelFuture future = boot.bind(PORT).sync();
            // Wait until the server socket is closed.
            future.channel().closeFuture().sync();
        } finally {
            // Shut down all event loops to terminate all threads.
            group.shutdownGracefully();
        }
    }
}

Frequently Asked Questions

What is the MsgEchoServer class?
MsgEchoServer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/udt/echo/message/MsgEchoServer.java.
Where is MsgEchoServer defined?
MsgEchoServer is defined in example/src/main/java/io/netty/example/udt/echo/message/MsgEchoServer.java at line 38.

Analyze Your Own Codebase

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

Try Supermodel Free