DiscardServer Class — netty Architecture
Architecture documentation for the DiscardServer class in DiscardServer.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 11cc58bf_fa4b_4751_3ec8_db2bb32c8b2c["DiscardServer"] fac0dcea_eda4_e599_2c2b_a1bd78bf603a["DiscardServer.java"] 11cc58bf_fa4b_4751_3ec8_db2bb32c8b2c -->|defined in| fac0dcea_eda4_e599_2c2b_a1bd78bf603a 12c63114_e805_07fa_6ca1_cee0274449a9["main()"] 11cc58bf_fa4b_4751_3ec8_db2bb32c8b2c -->|method| 12c63114_e805_07fa_6ca1_cee0274449a9
Relationship Graph
Source Code
example/src/main/java/io/netty/example/discard/DiscardServer.java lines 35–71
public final class DiscardServer {
static final int PORT = Integer.parseInt(System.getProperty("port", "8009"));
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) {
ChannelPipeline p = ch.pipeline();
if (sslCtx != null) {
p.addLast(sslCtx.newHandler(ch.alloc()));
}
p.addLast(new DiscardServerHandler());
}
});
// 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();
}
}
}
Source
Frequently Asked Questions
What is the DiscardServer class?
DiscardServer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/discard/DiscardServer.java.
Where is DiscardServer defined?
DiscardServer is defined in example/src/main/java/io/netty/example/discard/DiscardServer.java at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free