On 27/08/2020 19:43, Roger Marquis wrote:
> Mark Thomas wrote:
>> Those are all application issues. The application should shut itself
>> down cleanly. Tomcat is complaining because it hasn't.
> 
> I don't know Mark, most Java/Tomcat engineers expect an application to
> shutdown when it's os/container/shell/parent shuts-down.  Can you help
> us understand why Tomcat is different in this respect than say Apache
> httpd?

Java doesn't provide an API a cleanly stop another thread. If an
application starts a non-daemon thread but doesn't stop it there is
nothing Tomcat can do to stop that thread and the JVM won't shutdown
until the thread stops. Using OS level tools to stop the process is the
only option.

Hence, applications are responsible to cleaning up the resources they
create. For example, if an app starts a thread then the app is also
responsible for stopping it. Generally, apps use one or more
ServletContextListeners to do this.

Along similar lines, failing to clean up resources can also trigger
memory leaks. Tomcat will clean those up where it can and log the
problems it finds so the application can address them. While such issues
are unimportant when shutting Tomcat down entirely, they are much more
serious if the web application is being redeployed.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to