EchoServer Class — netty Architecture
Architecture documentation for the EchoServer class in EchoServer.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD cf55b502_e3e1_09ed_0834_e32e56aa80f0["EchoServer"] 4cb70145_7f51_63f6_42a7_10dab4ec034d["EchoServer.java"] cf55b502_e3e1_09ed_0834_e32e56aa80f0 -->|defined in| 4cb70145_7f51_63f6_42a7_10dab4ec034d 7474a929_1be6_ade8_795a_492d84095cdc["main()"] cf55b502_e3e1_09ed_0834_e32e56aa80f0 -->|method| 7474a929_1be6_ade8_795a_492d84095cdc
Relationship Graph
Source Code
example/src/main/java/io/netty/example/echo/EchoServer.java lines 36–75
public final class EchoServer {
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();
// Configure the server.
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
final EchoServerHandler serverHandler = new EchoServerHandler();
try {
ServerBootstrap b = new ServerBootstrap();
b.group(group)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_BACKLOG, 100)
.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 LoggingHandler(LogLevel.INFO));
p.addLast(serverHandler);
}
});
// Start the server.
ChannelFuture f = b.bind(PORT).sync();
// Wait until the server socket is closed.
f.channel().closeFuture().sync();
} finally {
// Shut down all event loops to terminate all threads.
group.shutdownGracefully();
}
}
}
Source
Frequently Asked Questions
What is the EchoServer class?
EchoServer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/echo/EchoServer.java.
Where is EchoServer defined?
EchoServer is defined in example/src/main/java/io/netty/example/echo/EchoServer.java at line 36.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free