org.figure8.join.util
Class ConnectionKeeperLauncher

java.lang.Object
  extended by org.figure8.join.util.ConnectionKeeperLauncher
All Implemented Interfaces:
java.util.EventListener, javax.servlet.ServletContextListener

public class ConnectionKeeperLauncher
extends java.lang.Object
implements javax.servlet.ServletContextListener

This a launcher for ConnectionKeeper threads implemented as a ServletContextListener.

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux

Field Summary
static java.lang.String HSQL_KEEPER_KEY
          Key used for registring the ConnectionKeeper within ServletContext
static int NB_CONNECTIONS
          Number of connections to keep open by ConnectionKeeper
static long SLEEP_TIME
          Sleeping time of the ConnectionKeeper
 
Constructor Summary
ConnectionKeeperLauncher()
          Creates a new instance of ConnectionKeeperLauncher
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
          Method called when context is destroyed
 void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
          Methad called when context is intialized.
static boolean startConnectionKeeperIfNecessary()
          Start a ConnectionKeeper thread only if necessary (ie. keeper has not already been started and database dialect is the one corresponding to Hypersonic SQL DB)
static boolean stopConnectionKeeperIfNecessary()
          Stop a ConnectionKeeper thread only if necessary (ie. a keeper already exists !)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NB_CONNECTIONS

public static final int NB_CONNECTIONS
Number of connections to keep open by ConnectionKeeper

See Also:
Constant Field Values

SLEEP_TIME

public static final long SLEEP_TIME
Sleeping time of the ConnectionKeeper

See Also:
Constant Field Values

HSQL_KEEPER_KEY

public static final java.lang.String HSQL_KEEPER_KEY
Key used for registring the ConnectionKeeper within ServletContext

See Also:
Constant Field Values
Constructor Detail

ConnectionKeeperLauncher

public ConnectionKeeperLauncher()
Creates a new instance of ConnectionKeeperLauncher

Method Detail

startConnectionKeeperIfNecessary

public static boolean startConnectionKeeperIfNecessary()
Start a ConnectionKeeper thread only if necessary (ie. keeper has not already been started and database dialect is the one corresponding to Hypersonic SQL DB)

Returns:
true if a keeper has actually been launched

stopConnectionKeeperIfNecessary

public static boolean stopConnectionKeeperIfNecessary()
Stop a ConnectionKeeper thread only if necessary (ie. a keeper already exists !)

Returns:
true if a keeper has actually been stopped, false otherwise

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
Methad called when context is intialized.

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener
Parameters:
servletContextEvent - Event received when context is initialized

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
Method called when context is destroyed

Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener
Parameters:
servletContextEvent - The event corresponding to context desctruction


Copyright © 2005-2008 Join. All Rights Reserved.