I was trying to understand the "best practices" for preventing a program from terminating in main, using a Jetty web server as an example.
Where can I find the code in Jetty that loops constantly waiting for a connection? Is Jetty essentially using a while(true)
loop somewhere? Or is there a more effective method to preventing the web server from terminating in main?
Jetty uses Java NIO to handle all Networking (listening, accepting, reading, writing, closing, etc).
See other answer on details about NIO accept.