Class ConnectionKeeper

  extended byjava.lang.Thread
      extended bycom.atlassian.confluence.util.ConnectionKeeper
All Implemented Interfaces:

public class ConnectionKeeper
extends Thread

This class is used to keep connections open to the database while JIRA is running. It is used with HSQLDB as HSQ DB, when running in-process, will shutdown as soon as no connections are open to it. When a new connection is opened to the HSQLDB it will start up again. However, this causes problems as more than one HSQLDB instance may be created at the same time and the two instances interfere wuth each other, possibly causing data loss.

As advised in the HSQLDB documentation, if HSQLDB is used in-process, a connection to it should be open at all times, to prevent the database from shutting down. One connections seems not to be good enough, though (probably due to a HSQLDB bug). Two connections does the trick.

This class is used as a thread that periodically establishes new connection(s) (or checks them out from a pool, in a pooled environment), and closes (releases back to the pool) the old connection(s). This is done to ensure that the pool (if one is used) does not close the "unused" connection on us.

Field Summary
Fields inherited from class java.lang.Thread
Constructor Summary
ConnectionKeeper(int numberConnections, int sleepMillis)
Method Summary
 void run()
 void shutdown()
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public ConnectionKeeper(int numberConnections,
                        int sleepMillis)
Method Detail


public void shutdown()


public void run()

Confluence is developed by Atlassian.