简体   繁体   中英

How to stop Embedded Tomcat gracefully and tomcat should get stopped only after the current processing requests have to complete

We have implemented embedded tomcat model java application. and running war file from java -jar command. the problem is how can i stop the server. and before server getting stopped, already fired requests to the server should get processed. then only i have to stop server. how can i implement this. thanks in advance.

Make your application when it is finished write to file /somedir/yoursecretfile

If using linux, make a cron job which check periodically if file /somedir/yoursecretfile exist and if the file exists, stops a web server (maybe with ps | grep | xargs or something like that).

If using other OS, use replacement for cron for that OS and script which stops a webserver.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM