|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.nec.tdd.tools.dbMapper.ConnectionPoolDataSource
Default database connection manager implementation provided by database module.
ConnectionPoolDataSource manages a pool of PoolableDBConnection objects to efficiently manage database resources. Pooling allows concurrent database operations in multi-threaded applications, with added bonus of DBConnection statement caching.
A number of PoolableDBConnection objects are created in advance (specified by initialCapacity property) and placed in pool. Once a user is done with a PoolableDBConnection, it returned to the pool (instead of closing and creating all connections and statements again).
The maxCapacity parameter defines an upper bound on number of opened connections at any time by this connection manager. If all the pooled connections for this connection manager are in use, the ConnectionPoolDataSource attempts to establish more database connection based on capacityIncrement property. In any case, the maxCapacity property is always honored. Some useful ConnectionPoolDataSource settings: 1. Fixed size (n) pool (all connections created at init time): initialCapacity=n; capacityIncrement=0; maxCapacity>=n 2. Growing pool with upper bound (n): initialCapacity>=0; capacityIncrement>=1; maxCapacity=n 3. Infinite growing pool : initialCapacity>=0; capacityIncrement>=1; maxCapacity=0
Constructor Summary | |
ConnectionPoolDataSource(DBConnectionInfo dbInfoBean)
Constructs a ConnectionPoolDataSource object with given database connection information. |
|
ConnectionPoolDataSource(DBConnectionInfo dbInfoBean,
int initialCapacity,
int capacityIncrement)
Constructs a ConnectionPoolDataSource object with given database connection information, initialCapacity and capacityIncrement. |
|
ConnectionPoolDataSource(DBConnectionInfo dbInfoBean,
int initialCapacity,
int capacityIncrement,
int maxCapacity)
Constructs a ConnectionPoolDataSource object with given database connection information, and pool parameters (initialCapacity, capacityIncrement and maxCapacity). |
Method Summary | |
void |
destroy()
Destry the connection manager. |
protected void |
finalize()
Override Object's finalize method to shutdown all the database connections in pool during garbage collection. |
DBConnection |
getConnection()
Get a DBConnection from the pool associated with this connection manager. |
void |
releaseConnection(DBConnection conn)
Method to release an previously acquired PoolableDBConnection to the pool. |
java.lang.String |
toString()
Returns string representation of ConnectionPoolDataSource, containing the string representation of pool and of each poolable item contained in the pool. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ConnectionPoolDataSource(DBConnectionInfo dbInfoBean) throws java.lang.Exception
dbInfoBean
- database connection information (JDBC url,
driver name, user & password).java.lang.Exception
- if a database access error occurs.public ConnectionPoolDataSource(DBConnectionInfo dbInfoBean, int initialCapacity, int capacityIncrement) throws java.lang.Exception
dbInfoBean
- database connection information (JDBC url,
driver name, user & password).initialCapacity
- the initial capacity of the pool.capacityIncrement
- the amount by which the capacity is increased
when the pool overflows.java.lang.Exception
- if a database access error occurs.public ConnectionPoolDataSource(DBConnectionInfo dbInfoBean, int initialCapacity, int capacityIncrement, int maxCapacity) throws java.lang.Exception
dbInfoBean
- database connection information (JDBC url,
driver name, user & password).initialCapacity
- the initial capacity of the pool.capacityIncrement
- the amount by which the capacity is increased
when the pool overflows.maxCapacity
- maximum number of connections opened at a time by
this connection manager. A <=0 value is treated as
unlimited connections.java.lang.Exception
- if a database access error occurs.Method Detail |
protected void finalize() throws java.lang.Exception
finalize
in class java.lang.Object
public DBConnection getConnection()
getConnection
in interface DataSource
public void releaseConnection(DBConnection conn)
releaseConnection
in interface DataSource
conn
- DBConnection to be released.public void destroy()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |