edu.mssm.crover.db.relational
Class ConnectionPool

java.lang.Object
  |
  +--edu.mssm.crover.db.relational.ConnectionPool

public class ConnectionPool
extends java.lang.Object

Pool of JDBC connections. This class superseeds edu.mssm.crover.scentral.ConnectionPool.


Field Summary
 boolean DEBUG
          DEBUG flag.
 
Constructor Summary
protected ConnectionPool(java.lang.String dbURL, java.lang.String user, java.lang.String password, java.lang.String driverClassName, int minConnections, int maxConnections, Log log)
          Constructs a connection pool.
 
Method Summary
protected  void checkActive()
           
 void deactivate()
          Force the finalization and flag this object as inactive.
protected  void finalize()
           
protected  java.sql.Connection getConnection()
           
 int getConnectionNumber()
          Returns the current number of open connections.
protected  void returnConnection(java.sql.Connection returned)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public boolean DEBUG
DEBUG flag. When DEBUG is true, the ConnectionPool logs messages.

Constructor Detail

ConnectionPool

protected ConnectionPool(java.lang.String dbURL,
                         java.lang.String user,
                         java.lang.String password,
                         java.lang.String driverClassName,
                         int minConnections,
                         int maxConnections,
                         Log log)
                  throws java.sql.SQLException,
                         java.lang.ClassNotFoundException
Constructs a connection pool. Makes sure only one is active at one time in a ClassLoader context. When a new connection pool is created, all the instances created before it are deactivated. Upon deactivation, instances close their connections with the database and so cannot be used anymore. Any attempt to use a deactivated connection pool results in an internal error.

Method Detail

deactivate

public void deactivate()
Force the finalization and flag this object as inactive. This instance closes its connections with the database and so cannot be used anymore. Any attempt to use this instance, after calling this method, results in an internal error (a FATAL diagnostic message is logged).


getConnectionNumber

public int getConnectionNumber()
Returns the current number of open connections. Connections can be open but inactive. This method is useful to test that a given client frees all connections it uses.


getConnection

protected java.sql.Connection getConnection()
                                     throws java.sql.SQLException
java.sql.SQLException

checkActive

protected void checkActive()

returnConnection

protected void returnConnection(java.sql.Connection returned)

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
java.lang.Throwable


Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.