On 28/02/2011 16:12, Olivier Lefevre wrote: >> Doing this from a servlet begs the question how you are going >> to restart it. > > Not an issue: I want to shut it down at startup if some needed > resources cannot be found. No pint restarting it then.
Fair enough. I wouldn't do it in a Servlet.init() though. A ServletContextListener that stops the app starting is probably better. Your application may be on a shared Tomcat instance someday and System.exit is really bad in that case. If you really do want to control Tomcat startup, a LifecycleListener is a better approach but Tomcat specific. >> I'm also curious why you want tot do this but System.exit() will >> have exactly the same result as using the shutdown port. > > Does Tomcat set up appropriate shutdown hooks when it starts? > Otherwise tearing down the VM could cause damage to external > resources at least. Yes, which is why I wrote "System.exit() will have exactly the same result as using the shutdown port.". Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org