main() — netty Function Reference
Architecture documentation for the main() function in ByteEchoServer.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 7aa5c29f_1b65_3e57_a2c7_2799b353f5e6["main()"] c077e3e6_8233_4c90_f01f_cd17519635c3["ByteEchoServer"] 7aa5c29f_1b65_3e57_a2c7_2799b353f5e6 -->|defined in| c077e3e6_8233_4c90_f01f_cd17519635c3 style 7aa5c29f_1b65_3e57_a2c7_2799b353f5e6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/udt/echo/bytes/ByteEchoServer.java lines 42–71
public static void main(String[] args) throws Exception {
final ThreadFactory factory = new DefaultThreadFactory("udt");
final EventLoopGroup group = new MultiThreadIoEventLoopGroup(
1, factory, NioIoHandler.newFactory(NioUdtProvider.BYTE_PROVIDER));
// Configure the server.
try {
final ServerBootstrap boot = new ServerBootstrap();
boot.group(group)
.channelFactory(NioUdtProvider.BYTE_ACCEPTOR)
.option(ChannelOption.SO_BACKLOG, 10)
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new ChannelInitializer<UdtChannel>() {
@Override
public void initChannel(final UdtChannel ch)
throws Exception {
ch.pipeline().addLast(
new LoggingHandler(LogLevel.INFO),
new ByteEchoServerHandler());
}
});
// Start the server.
final ChannelFuture future = boot.bind(PORT).sync();
// Wait until the server socket is closed.
future.channel().closeFuture().sync();
} finally {
// Shut down all event loops to terminate all threads.
group.shutdownGracefully();
}
}
Domain
Subdomains
Source
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/ByteEchoServer.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/udt/echo/bytes/ByteEchoServer.java at line 42.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free