Home / Function/ main() — netty Function Reference

main() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7d68e9ba_c5dc_565f_7520_2942ebcad23e["main()"]
  0c45575b_0194_329b_b46b_0a4e531ee724["UptimeServer"]
  7d68e9ba_c5dc_565f_7520_2942ebcad23e -->|defined in| 0c45575b_0194_329b_b46b_0a4e531ee724
  style 7d68e9ba_c5dc_565f_7520_2942ebcad23e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/uptime/UptimeServer.java lines 40–64

    public static void main(String[] args) throws Exception {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.group(group)
                    .channel(NioServerSocketChannel.class)
                    .handler(new LoggingHandler(LogLevel.INFO))
                    .childHandler(new ChannelInitializer<SocketChannel>() {
                        @Override
                        public void initChannel(SocketChannel ch) {
                            ch.pipeline().addLast(handler);
                        }
                    });

            // Bind and start to accept incoming connections.
            ChannelFuture f = b.bind(PORT).sync();

            // Wait until the server socket is closed.
            // In this example, this does not happen, but you can do that to gracefully
            // shut down your server.
            f.channel().closeFuture().sync();
        } finally {
            group.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/uptime/UptimeServer.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/uptime/UptimeServer.java at line 40.

Analyze Your Own Codebase

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

Try Supermodel Free