tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Lefevre <>
Subject Re: Getting the Tomcat shutdown port
Date Mon, 28 Feb 2011 16:59:18 GMT
> Your application may be on a shared Tomcat instance someday
> and System.exit is really bad in that case.

True. So let's kill the servlet instead. But it's still unclear
how you'd do that because from the ServletConfig you can get the
ServletContext but from the ServletContext you can no longer get
the Servlet: that has been deprecated and that getter now returns
null. But perhaps I am looking in the wrong direction: the
Servlet.destroy APIdoc says "Called by the servlet container to
indicate to a servlet that the servlet is being taken out of service."
which implies that the teardown is initiated elsewhere and that
simply calling destroy wouldn't do anything useful.

> If you really do want to control Tomcat startup, a LifecycleListener
 > is a better approach but Tomcat specific.

There are plenty of LifecycleListener classes in the API; which
one would work best: ServerLifecycleListener?

-- O.L.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message