org.deegree_impl.io
Class DBConnectionPool

java.lang.Object
  extended byorg.deegree_impl.io.DBConnectionPool

public class DBConnectionPool
extends java.lang.Object

class to manage a database connection pool. this is part of the combination of the object pool pattern an the singelton pattern.

----------------------------------------------------------

Version:
07.02.2001

Author:
Andreas Poth

Field Summary
private static DBConnectionPool instance
           
private  java.util.HashMap pools
           
 
Constructor Summary
private DBConnectionPool()
          Creates a new DBConnectionPool object.
 
Method Summary
 java.sql.Connection acuireConnection(java.lang.String driver, java.lang.String database, java.util.Properties properties)
          get an object from the object pool
 java.sql.Connection acuireConnection(java.lang.String driver, java.lang.String database, java.lang.String user, java.lang.String password)
          get an object from the object pool
static DBConnectionPool getInstance()
          realize singelton pattern using double checked locking pattern.
 void releaseConnection(java.sql.Connection con, java.lang.String driver, java.lang.String database, java.util.Properties properties)
          releases a connection back to the pool
 void releaseConnection(java.sql.Connection con, java.lang.String driver, java.lang.String database, java.lang.String user, java.lang.String password)
          releases a connection back to the pool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static DBConnectionPool instance

pools

private java.util.HashMap pools
Constructor Detail

DBConnectionPool

private DBConnectionPool()
Creates a new DBConnectionPool object.

Method Detail

getInstance

public static DBConnectionPool getInstance()
realize singelton pattern using double checked locking pattern.

Returns:
an instance of the data base pool. it is gauranteed that there exists only one instance of pool for each submitted class name.

acuireConnection

public java.sql.Connection acuireConnection(java.lang.String driver,
                                            java.lang.String database,
                                            java.lang.String user,
                                            java.lang.String password)
                                     throws java.lang.Exception
get an object from the object pool

Throws:
java.lang.Exception

acuireConnection

public java.sql.Connection acuireConnection(java.lang.String driver,
                                            java.lang.String database,
                                            java.util.Properties properties)
                                     throws java.lang.Exception
get an object from the object pool

Throws:
java.lang.Exception

releaseConnection

public void releaseConnection(java.sql.Connection con,
                              java.lang.String driver,
                              java.lang.String database,
                              java.lang.String user,
                              java.lang.String password)
                       throws java.lang.Exception
releases a connection back to the pool

Throws:
java.lang.Exception

releaseConnection

public void releaseConnection(java.sql.Connection con,
                              java.lang.String driver,
                              java.lang.String database,
                              java.util.Properties properties)
                       throws java.lang.Exception
releases a connection back to the pool

Throws:
java.lang.Exception