Class ConnectionKeeper

  extended by java.lang.Thread
      extended by com.atlassian.jira.upgrade.ConnectionKeeper
All Implemented Interfaces:
Shutdown, java.lang.Runnable

public class ConnectionKeeper
extends java.lang.Thread
implements Shutdown

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.

Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
Field Summary
Fields inherited from class java.lang.Thread
Constructor Summary
ConnectionKeeper(java.lang.String ofbizHelperName, int numberConnections, int sleepMillis)
Method Summary
 void run()
 void shutdown()
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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(java.lang.String ofbizHelperName,
                        int numberConnections,
                        int sleepMillis)
Method Detail


public void shutdown()
Description copied from interface: Shutdown
Shutdown. Should not throw any exceptions.

Specified by:
shutdown in interface Shutdown


public void run()
Specified by:
run in interface java.lang.Runnable
run in class java.lang.Thread

Copyright © 2002-2010 Atlassian. All Rights Reserved.