Home / Class/ ObjectEchoServer Class — netty Architecture

ObjectEchoServer Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  02da72f5_a9ac_943b_1882_efc91026f606["ObjectEchoServer"]
  78db8202_ee6f_9765_7d58_a3137782eded["ObjectEchoServer.java"]
  02da72f5_a9ac_943b_1882_efc91026f606 -->|defined in| 78db8202_ee6f_9765_7d58_a3137782eded
  41983198_1520_a420_39ea_e1f1082bb29b["main()"]
  02da72f5_a9ac_943b_1882_efc91026f606 -->|method| 41983198_1520_a420_39ea_e1f1082bb29b

Relationship Graph

Source Code

example/src/main/java/io/netty/example/objectecho/ObjectEchoServer.java lines 38–73

public final class ObjectEchoServer {

    static final boolean SSL = System.getProperty("ssl") != null;
    static final int PORT = Integer.parseInt(System.getProperty("port", "8007"));

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

        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) throws Exception {
                    ChannelPipeline p = ch.pipeline();
                    if (sslCtx != null) {
                        p.addLast(sslCtx.newHandler(ch.alloc()));
                    }
                    p.addLast(
                            new ObjectEncoder(),
                            new ObjectDecoder(ClassResolvers.cacheDisabled(null)),
                            new ObjectEchoServerHandler());
                }
             });

            // Bind and start to accept incoming connections.
            b.bind(PORT).sync().channel().closeFuture().sync();
        } finally {
            group.shutdownGracefully();
        }
    }
}

Frequently Asked Questions

What is the ObjectEchoServer class?
ObjectEchoServer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/objectecho/ObjectEchoServer.java.
Where is ObjectEchoServer defined?
ObjectEchoServer is defined in example/src/main/java/io/netty/example/objectecho/ObjectEchoServer.java at line 38.

Analyze Your Own Codebase

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

Try Supermodel Free