Home / Function/ main() — netty Function Reference

main() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7c11d884_969e_f111_52dc_ed8df65ceaf1["main()"]
  7176b634_bea9_f9ba_767d_a434f542eb50["WorldClockClient"]
  7c11d884_969e_f111_52dc_ed8df65ceaf1 -->|defined in| 7176b634_bea9_f9ba_767d_a434f542eb50
  style 7c11d884_969e_f111_52dc_ed8df65ceaf1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/worldclock/WorldClockClient.java lines 41–71

    public static void main(String[] args) throws Exception {
        // Configure SSL.
        final SslContext sslCtx = ServerUtil.buildSslContext();

        EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
        try {
            Bootstrap b = new Bootstrap();
            b.group(group)
             .channel(NioSocketChannel.class)
             .handler(new WorldClockClientInitializer(sslCtx));

            // Make a new connection.
            Channel ch = b.connect(HOST, PORT).sync().channel();

            // Get the handler instance to initiate the request.
            WorldClockClientHandler handler = ch.pipeline().get(WorldClockClientHandler.class);

            // Request and get the response.
            List<String> response = handler.getLocalTimes(CITIES);

            // Close the connection.
            ch.close();

            // Print the response at last but not least.
            for (int i = 0; i < CITIES.size(); i ++) {
                System.out.format("%28s: %s%n", CITIES.get(i), response.get(i));
            }
        } 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/worldclock/WorldClockClient.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/worldclock/WorldClockClient.java at line 41.

Analyze Your Own Codebase

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

Try Supermodel Free