Fix memory leaks

Merged
#36 · Created  · Last updated

Merged pull request

Use javadoc and comments from upstream

54297a1·Author: ·Closed by: ·2016-12-02

Description

  • Proper shutdown of the JDBC drivers

    Deregister all JDBC drivers loaded by the WebappClassloader on context shutdown to avoid a memory leak.

    Special handling is needed for the mysql JDBC driver as the AbandonedConnectionCleanupThread must be shut down manually before the driver is deregistered.

    The whole shutdown process is done with reflections to avoid dependencies to non existing JDBC drivers.

  • Shutdown the sessions cleanup thread

    Cancel the timer thread on context shutdown to stop the session cleanup of a non existing web application and to avoid a memory leak

  • Get rid of the usage of the java preferences system

    The usage of the preferences system has some drawbacks: - Storing the preferences in the users context lead to undefined behavior when there are multiple instances of mainzelliste with different configurations running in the same JVM or as the same system user. - Implementations of the preferences system might use resources that cannot be freed throw the API and causing memory leaks when used within web application (e.g. On Linux the implementation starts a synchronizer thread that keeps the prefs-Files up to date. This thread can only be stopped by a JVM shutdown)

    This fix eliminates the use of the preferences system at all. To simulate the hierarchical access to configuration properties the fix introduces the helper class PropertyIterator that can be used to iterate over properties.

  • Cleanup the shutdown process of the persistor class

    Make use of the servlet API 3.0 to get the webapp classloader and harden the classloader matching

  • Use the Initializer class to also handle context shutdowns

  • Improve the PropertyIterator

    • Do not inherit the Iterator-interface directly

    • Error handling

    • Fixes in prefix handling

  • Log shut down

  • Use javadoc and comments from upstream

0 attachments

0 comments

Loading commits...