Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-8247

Properly stop HSQLDB and clean the connection pool at XWiki shutdown

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 4.3-milestone-1
    • 4.2
    • Storage
    • None
    • Unknown
    • N/A
    • N/A

    Description

      Right now when HSQLDB stops there's a xwiki_db.log file left over. This is because HSQLDB is not shutdown properly:

      While the "test" database is operational, a test.log file is used to write the changes made to data. This file is removed at a normal SHUTDOWN. Otherwise (with abnormal shutdown) this file is used at the next startup to redo the changes.

      What we do is to specify "shutdown=true" in the JDBC connection URL:

      If this property is true, when the last connection to a database is closed, the database is automatically shut down. The property takes effect only when the first connection is made to the database. This means the connection that opens the database. It has no effect if used with subsequent connections.

      This command has two uses. One is for test suites, where connections to the database are made from one JVM context, immediately followed by another context. The other use is for applications where it is not easy to configure the environment to shutdown the database. Examples reported by users include web application servers, where the closing of the last connection coincides with the web app being shut down.

      Thus to stop HSQLDB cleanly we can simply close all open connections to the Database when XWiki exits. This is often something good to do when XWiki manages its own connection pool (the default) since redeploying the webapp would recreate connections to the DB and potentially not removing existing ones from a previous deployment.

      However if the user has configured XWiki to use the app server's Data Source then the connection pool is handled by the app server and closing it is going to cause problems...

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: