The com.netflix.zuul.netty.server.Server class is the primary entrypoint for starting a Zuul Netty server. It manages the lifecycle of the server, including binding to multiple socket addresses, managing event loops, and handling graceful shutdowns.
To use the Server, you should provide a Registry for metrics, a ServerStatusManager for lifecycle status, a map of NamedSocketAddress to ChannelInitializer for defining how connections are handled on specific ports, a ClientConnectionsShutdown handler, EventLoopGroupMetrics for monitoring, and an EventLoopConfig for tuning thread counts and backlog sizes.
Key lifecycle methods:
start(): Initializes the transport, sets up event loops, and binds to the requested addresses. It also registers a JVM shutdown hook by default.stop(): Shuts down the server group and stops accepting new connections.awaitTermination(): Blocks until all bound channels have closed.getListeningAddresses(): Returns a list of the addresses the server is currently listening on.
Server server = new Server(
registry,
serverStatusManager,
addressesToInitializers,
clientConnectionsShutdown,
eventLoopGroupMetrics,
eventLoopConfig
);
server.start();
// ... run server ...
server.awaitTermination();