SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.jdbc
Class ConfigurableConnectionPool

java.lang.Object
  |
  +--org.apache.commons.pool.BaseKeyedObjectPool
        |
        +--org.apache.commons.pool.impl.GenericKeyedObjectPool
              |
              +--com.solarmetric.rd.jdbc.ConfigurableConnectionPool
All Implemented Interfaces:
ConnectionPool, org.apache.commons.pool.KeyedObjectPool, org.apache.commons.pool.KeyedPoolableObjectFactory
Direct Known Subclasses:
PSCacheConnectionPool

public class ConfigurableConnectionPool
extends org.apache.commons.pool.impl.GenericKeyedObjectPool
implements ConnectionPool, org.apache.commons.pool.KeyedPoolableObjectFactory

Provides basic pooling. Recognizes the following configuration options:


Field Summary
 
Fields inherited from class org.apache.commons.pool.impl.GenericKeyedObjectPool
_activeMap, _evictor, _factory, _maxActive, _maxIdle, _maxWait, _minEvictableIdleTimeMillis, _numTestsPerEvictionRun, _poolList, _poolMap, _testOnBorrow, _testOnReturn, _testWhileIdle, _timeBetweenEvictionRunsMillis, _totalActive, _totalIdle, _whenExhaustedAction, DEFAULT_MAX_ACTIVE, DEFAULT_MAX_IDLE, DEFAULT_MAX_WAIT, DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_NUM_TESTS_PER_EVICTION_RUN, DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN, DEFAULT_TEST_WHILE_IDLE, DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_WHEN_EXHAUSTED_ACTION, WHEN_EXHAUSTED_BLOCK, WHEN_EXHAUSTED_FAIL, WHEN_EXHAUSTED_GROW
 
Constructor Summary
ConfigurableConnectionPool()
           
 
Method Summary
 void activateObject(java.lang.Object key, java.lang.Object value)
           
 void addJDBCListener(com.solarmetric.rd.jdbc.JDBCListener listener)
          Add an event listener.
 void close()
          Free the resources used by this pool.
 void destroyObject(java.lang.Object key, java.lang.Object obj)
           
 java.sql.Connection getConnection(com.solarmetric.rd.jdbc.ConnectionRequestInfo cri)
          Return a connection matching the given request info.
 com.solarmetric.rd.jdbc.DataSourceImpl getDataSource()
          Return the data source set with setDataSource(com.solarmetric.rd.jdbc.DataSourceImpl).
 boolean getTestOnReturn()
          Whether to test connections when they are returned to the pool.
 int getTimeBetweenConnectionValidationsMillis()
          The minimum number of milliseconds to wait between validation tests on a connection.
 int getTransactionIsolation()
          The transaction isolation level.
 java.lang.String getValidationSQL()
          Return the SQL to use to validate connections.
 java.lang.Object makeObject(java.lang.Object key)
           
 void passivateObject(java.lang.Object key, java.lang.Object value)
           
 boolean removeJDBCListener(com.solarmetric.rd.jdbc.JDBCListener listener)
          Remove an event listener.
 void returnConnection(java.sql.Connection conn)
          Connections can use this method to return themselves on close.
 void setDataSource(com.solarmetric.rd.jdbc.DataSourceImpl ds)
          This method will be called before the pool is used.
 void setQueryTimeout(int timeout)
          The number of seconds to wait for a query to execute before terminating it.
 void setTestOnReturn(boolean testOnReturn)
          Whether to test connections when they are returned to the pool.
 void setTimeBetweenConnectionValidationsMillis(int time)
          The minimum number of milliseconds to wait between validation tests on a connection.
 void setTransactionIsolation(int isolation)
          The transaction isolation level.
 void setTransactionIsolationLevel(java.lang.String isolation)
          The transaction isolation level.
 void setValidationSQL(java.lang.String sql)
          Set the SQL to use to validate connections.
 boolean validateObject(java.lang.Object key, java.lang.Object obj)
           
protected  java.sql.Connection wrapConnection(java.sql.Connection dataStoreConn)
          Decorate the given connection if desired.
 
Methods inherited from class org.apache.commons.pool.impl.GenericKeyedObjectPool
borrowObject, clear, clear, getMaxActive, getMaxIdle, getMaxWait, getMinEvictableIdleTimeMillis, getNumActive, getNumActive, getNumIdle, getNumIdle, getNumTestsPerEvictionRun, getTestOnBorrow, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, getWhenExhaustedAction, returnObject, setConfig, setFactory, setMaxActive, setMaxIdle, setMaxWait, setMinEvictableIdleTimeMillis, setNumTestsPerEvictionRun, setTestOnBorrow, setTestWhileIdle, setTimeBetweenEvictionRunsMillis, setWhenExhaustedAction
 
Methods inherited from class org.apache.commons.pool.BaseKeyedObjectPool
numActive, numActive, numIdle, numIdle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurableConnectionPool

public ConfigurableConnectionPool()
Method Detail

setDataSource

public void setDataSource(com.solarmetric.rd.jdbc.DataSourceImpl ds)
Description copied from interface: ConnectionPool
This method will be called before the pool is used.

Specified by:
setDataSource in interface ConnectionPool

getDataSource

public com.solarmetric.rd.jdbc.DataSourceImpl getDataSource()
Description copied from interface: ConnectionPool
Return the data source set with ConnectionPool.setDataSource(com.solarmetric.rd.jdbc.DataSourceImpl).

Specified by:
getDataSource in interface ConnectionPool

getValidationSQL

public java.lang.String getValidationSQL()
Return the SQL to use to validate connections.


setValidationSQL

public void setValidationSQL(java.lang.String sql)
Set the SQL to use to validate connections.


getTimeBetweenConnectionValidationsMillis

public int getTimeBetweenConnectionValidationsMillis()
The minimum number of milliseconds to wait between validation tests on a connection.


setTimeBetweenConnectionValidationsMillis

public void setTimeBetweenConnectionValidationsMillis(int time)
The minimum number of milliseconds to wait between validation tests on a connection.


getTestOnReturn

public boolean getTestOnReturn()
Whether to test connections when they are returned to the pool.

Overrides:
getTestOnReturn in class org.apache.commons.pool.impl.GenericKeyedObjectPool

setTestOnReturn

public void setTestOnReturn(boolean testOnReturn)
Whether to test connections when they are returned to the pool.

Overrides:
setTestOnReturn in class org.apache.commons.pool.impl.GenericKeyedObjectPool

setQueryTimeout

public void setQueryTimeout(int timeout)
The number of seconds to wait for a query to execute before terminating it.


getTransactionIsolation

public int getTransactionIsolation()
The transaction isolation level.


setTransactionIsolation

public void setTransactionIsolation(int isolation)
The transaction isolation level.


setTransactionIsolationLevel

public void setTransactionIsolationLevel(java.lang.String isolation)
The transaction isolation level.


addJDBCListener

public void addJDBCListener(com.solarmetric.rd.jdbc.JDBCListener listener)
Add an event listener.


removeJDBCListener

public boolean removeJDBCListener(com.solarmetric.rd.jdbc.JDBCListener listener)
Remove an event listener.


getConnection

public java.sql.Connection getConnection(com.solarmetric.rd.jdbc.ConnectionRequestInfo cri)
                                  throws java.sql.SQLException
Description copied from interface: ConnectionPool
Return a connection matching the given request info.

Specified by:
getConnection in interface ConnectionPool
java.sql.SQLException

returnConnection

public void returnConnection(java.sql.Connection conn)
Description copied from interface: ConnectionPool
Connections can use this method to return themselves on close.

Specified by:
returnConnection in interface ConnectionPool

close

public void close()
Description copied from interface: ConnectionPool
Free the resources used by this pool.

Specified by:
close in interface ConnectionPool
Overrides:
close in class org.apache.commons.pool.impl.GenericKeyedObjectPool

makeObject

public java.lang.Object makeObject(java.lang.Object key)
                            throws java.sql.SQLException
Specified by:
makeObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory
java.sql.SQLException

destroyObject

public void destroyObject(java.lang.Object key,
                          java.lang.Object obj)
Specified by:
destroyObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory

validateObject

public boolean validateObject(java.lang.Object key,
                              java.lang.Object obj)
Specified by:
validateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory

activateObject

public void activateObject(java.lang.Object key,
                           java.lang.Object value)
Specified by:
activateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory

passivateObject

public void passivateObject(java.lang.Object key,
                            java.lang.Object value)
Specified by:
passivateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory

wrapConnection

protected java.sql.Connection wrapConnection(java.sql.Connection dataStoreConn)
                                      throws java.sql.SQLException
Decorate the given connection if desired.

java.sql.SQLException

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.