bmuschko/gradle-tomcat-plugin — Issue #21: Tomcat doesn't seem to shutdown gracefully when exiting after tomcatRun
Author: robertjdavidson
Created: 2012-01-20 11:48:57+00:00
State: open

Spring offers the ability to subscribe to context lifecycle events including contact start and stop. These events are often used in development and testing and a typical example is to develop a class that creates data on start and deletes it on exit.

When stopping tomcat following tomcatRun by pressing Ctrl+C on the console, tomcat seems to be just exit immediately rather than stopping the application gracefully giving Spring the chance to close the context cleanly.

The sample app I created for #20 also demonstrates this problem. The app can be downloaded from here:

https://www.strongspace.com/rdavidson/public/sample-app.tar

The console outputs the various Spring context events as they occur. Quitting jettyRun and tomcatRun shows the difference. The jettyRun task shows that the app is shutdown cleanly by allowing ContextClosedEvents to be handled.