I am killing my Google App Engine dev server with kill
. I would like to clean up some local changes before the server dies. How can I do it?
To kill dev server you can simply press control-c
as the docs state:
To stop the web server, press Control-C (on Windows, Mac or Linux).
Control-c is in Unix systems sends the SIGINT signal, which you can achieve manually via kill -SIGINT <pid>
.
This should gracefully shutdown the server - in this case you can install a lifecycle listener to get called when server shuts down. Just implement the contextDestroyed(..)
method as shown in this example and register it in your web.xml
.
NOTE: such shutdown hook does NOT work on production server (verified). I never tried it on dev server, but it should work as this is plain Jetty.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.