I have this web application, which buffers stuff and then batch inserts said stuff into the DB. Now I want to be able to do a final batch insert whenever a Tomcat shutdown event is happening, so that I don't loose my stuff.
My app is a pretty simple Guice+Jersey API.
I've tried overriding contextDestroy
of GuiceServletContextListener
but it ends up in an NPE, because my injected dependencies seem to have been GC'ed at that point.
null
. It's more likely that tomcat is trying to prevent memory leaks and is preventing new JDBC connections from being made. But that's only a guess. – Isaiah van der Elst Oct 9 '15 at 16:25