Home / Class/ ByteEchoServer Class — netty Architecture

ByteEchoServer Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  c077e3e6_8233_4c90_f01f_cd17519635c3["ByteEchoServer"]
  6533afd9_0384_700a_1644_0a612a5b6d13["ByteEchoServer.java"]
  c077e3e6_8233_4c90_f01f_cd17519635c3 -->|defined in| 6533afd9_0384_700a_1644_0a612a5b6d13
  7aa5c29f_1b65_3e57_a2c7_2799b353f5e6["main()"]
  c077e3e6_8233_4c90_f01f_cd17519635c3 -->|method| 7aa5c29f_1b65_3e57_a2c7_2799b353f5e6

Relationship Graph

Source Code

example/src/main/java/io/netty/example/udt/echo/bytes/ByteEchoServer.java lines 38–72

public final class ByteEchoServer {

    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.BYTE_PROVIDER));

        // Configure the server.
        try {
            final ServerBootstrap boot = new ServerBootstrap();
            boot.group(group)
                    .channelFactory(NioUdtProvider.BYTE_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 ByteEchoServerHandler());
                        }
                    });
            // 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 ByteEchoServer class?
ByteEchoServer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/udt/echo/bytes/ByteEchoServer.java.
Where is ByteEchoServer defined?
ByteEchoServer is defined in example/src/main/java/io/netty/example/udt/echo/bytes/ByteEchoServer.java at line 38.

Analyze Your Own Codebase

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

Try Supermodel Free