shutdown hook for java web application

前端 未结 4 1973
闹比i
闹比i 2020-11-28 08:40

I need to save some data preferrably when the java web application is stopped, or when tomcat is stopped. how can this be done? Edit: any drawback if I use the jvm shutdown

4条回答
  •  时光取名叫无心
    2020-11-28 09:16

    I suggest using ehcache to cache this information. If you use ehcache's persistent store, then when you start Tomcat again, the cached data will still be available.

    In effect, this delegates the issue to ehcache, which is optimised for these types of problems.

提交回复
热议问题