HAProxyServer Class — netty Architecture
Architecture documentation for the HAProxyServer class in HAProxyServer.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD be934c1f_7694_9c3a_a71d_599bf08a090e["HAProxyServer"] fa6f984c_738c_b066_e630_4276f63513bb["HAProxyServer.java"] be934c1f_7694_9c3a_a71d_599bf08a090e -->|defined in| fa6f984c_738c_b066_e630_4276f63513bb bdd71917_2c99_a6b1_77c8_62250ade04ec["main()"] be934c1f_7694_9c3a_a71d_599bf08a090e -->|method| bdd71917_2c99_a6b1_77c8_62250ade04ec
Relationship Graph
Source Code
example/src/main/java/io/netty/example/haproxy/HAProxyServer.java lines 35–71
public final class HAProxyServer {
static final int PORT = Integer.parseInt(System.getProperty("port", "8080"));
public static void main(String[] args) throws Exception {
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
try {
ServerBootstrap b = new ServerBootstrap();
b.group(group)
.channel(NioServerSocketChannel.class)
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new HAProxyServerInitializer());
b.bind(PORT).sync().channel().closeFuture().sync();
} finally {
group.shutdownGracefully();
}
}
static class HAProxyServerInitializer extends ChannelInitializer<SocketChannel> {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(
new LoggingHandler(LogLevel.DEBUG),
new HAProxyMessageDecoder(),
new SimpleChannelInboundHandler() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HAProxyMessage) {
System.out.println("proxy message: " + msg);
} else if (msg instanceof ByteBuf) {
System.out.println("bytebuf message: " + ByteBufUtil.prettyHexDump((ByteBuf) msg));
}
}
});
}
}
}
Source
Frequently Asked Questions
What is the HAProxyServer class?
HAProxyServer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/haproxy/HAProxyServer.java.
Where is HAProxyServer defined?
HAProxyServer is defined in example/src/main/java/io/netty/example/haproxy/HAProxyServer.java at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free