Home / Function/ main() — netty Function Reference

main() — netty Function Reference

Architecture documentation for the main() function in ByteEchoClient.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d6b28235_0266_ff7c_f87b_513098cfcebb["main()"]
  4728a667_2a29_5d5c_bb4b_11023c4390de["ByteEchoClient"]
  d6b28235_0266_ff7c_f87b_513098cfcebb -->|defined in| 4728a667_2a29_5d5c_bb4b_11023c4390de
  style d6b28235_0266_ff7c_f87b_513098cfcebb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/udt/echo/bytes/ByteEchoClient.java lines 46–72

    public static void main(String[] args) throws Exception {
        // Configure the client.
        final ThreadFactory connectFactory = new DefaultThreadFactory("connect");
        final EventLoopGroup connectGroup = new MultiThreadIoEventLoopGroup(1,
                connectFactory, NioIoHandler.newFactory(NioUdtProvider.BYTE_PROVIDER));
        try {
            final Bootstrap boot = new Bootstrap();
            boot.group(connectGroup)
                    .channelFactory(NioUdtProvider.BYTE_CONNECTOR)
                    .handler(new ChannelInitializer<UdtChannel>() {
                        @Override
                        public void initChannel(final UdtChannel ch)
                                throws Exception {
                            ch.pipeline().addLast(
                                    new LoggingHandler(LogLevel.INFO),
                                    new ByteEchoClientHandler());
                        }
                    });
            // Start the client.
            final ChannelFuture f = boot.connect(HOST, PORT).sync();
            // Wait until the connection is closed.
            f.channel().closeFuture().sync();
        } finally {
            // Shut down the event loop to terminate all threads.
            connectGroup.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/udt/echo/bytes/ByteEchoClient.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/udt/echo/bytes/ByteEchoClient.java at line 46.

Analyze Your Own Codebase

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

Try Supermodel Free