Hi all, I'm just wondering how Tomcat stop its own service. How can "java Bootstrap stop" as in shutdown.bat/sh contacting the server to shutdown that already started by "java Bootstrap start" and exits? (I think the server is running in different JVM than the "Bootstrap stop") Is there any special trick that I don't know about? Is it something to do with thread.setDaemon(true)? Thank you in advance.
I would imagine that after running the destroy methods of all running servlets and closing down the session maintenance mechanism, it simply calls System.exit(0) - that will do it every time. You could search the source code for "System.exit" ... Bill
If you look at the Tomcat server config file, you'll find that there's a special port dedicated to listening for shutdown commands. The Bootstrap class presumably connects to this port to shut the server down.