intermine/intermine — pull request #894 by rnsmith (2014-12-18 17:17:47+00:00)
Title: Fix webapp PermGen memory leak

Clean up webapp shutdown procedure and de-register ShutdownHook from JVM which was preventing WebappClassLoader from being garbage collected. I can now deploy/undeploy a webapp continually without causing a PermGen out of memory error. Fixes #679.

Note that the use of a ShutdownHook in a webapp isn't best practice and we're calling and de-registering it explicitly in InitialiserPlugin.destroy(). This is somewhat hacky but does mean the shutdown procedure is consistent whether the ObjectStore is used in tomcat or from the command line.

I still see some database connections not being closed, related to the BatchFlusher when I undeploy a webapp, not worked out yet what's happening with them.