org.figure8.join.util
Class ConnectionKeeper

java.lang.Object
  extended by java.lang.Thread
      extended by org.figure8.join.util.ConnectionKeeper
All Implemented Interfaces:
java.lang.Runnable

public class ConnectionKeeper
extends java.lang.Thread

An extension of thread that helps keeping Hibernate connections open. This hack is necessary for Hypersonic SQL that closes access to database if connections have been idle for too long !

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux

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
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ConnectionKeeper(int numConnections, long sleepTime)
          Creates a new instance of ConnectionKeeper
 
Method Summary
 void run()
          Run connection keeper thread.
 void shutdown()
          Shutdown connection keeper thread.
 
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

ConnectionKeeper

public ConnectionKeeper(int numConnections,
                        long sleepTime)
                 throws InvalidParameterException
Creates a new instance of ConnectionKeeper

Parameters:
numConnections - Number of connections to keep open
sleepTime - Sleeping time in milliseconds
Throws:
InvalidParameterException - if container context is not initialized and "sessionFactory" bean is not available yet.
Method Detail

shutdown

public void shutdown()
Shutdown connection keeper thread.


run

public void run()
Run connection keeper thread.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread


Copyright © 2005-2008 Join. All Rights Reserved.