commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave, Tushar" <tushar.d...@employease.com>
Subject RE: [DBCP] Connection gets blocked on 9th connection.
Date Tue, 07 Aug 2007 19:55:09 GMT
I am initializing the Pool as below.
 
private void initialize(ConnectionPoolParameters oParams)
  {
    GenericObjectPool oPool = new GenericObjectPool(null);
    oPool.setMaxActive(oParams.getMaxSize());
    oPool.setMaxIdle (oParams.getMinSize ());
    oPool.setMinIdle(oParams.getMinSize());
    oPool.setMaxWait(oParams.getTimeout());
    oPool.setTestOnBorrow(true);
        
    setWhenExhaustedAction(oParams.getExhaustAction());
       
    BasicDataSource oDataSource = new BasicDataSource();
    oDataSource.setDriverClassName(oParams.getDriver());
    oDataSource.setUrl(oParams.getJdbcUrl());
    oDataSource.setValidationQuery(oParams.getConnectionTest());
 
    ConnectionFactory oFactory = new
DataSourceConnectionFactory(oDataSource);
    
    PoolableConnectionFactory oPoolFactory =
      new PoolableConnectionFactory(oFactory, this, null,
oParams.getConnectionTest (), false, true);
    
    _oDataSource = new PoolingDataSource(this);
    _bEnabled = true;
  }
It seems that BasicDataSource creates its own Pool and
PoolableConnectionFactory and it has the default settings of the Pool
(maxSize=8).
So If I specified 30 as the max connections it still thinks 8 as the max
connections.
 
Am I initializing the pool properly?
 
--Tushar 

 

 

________________________________

From: Dave, Tushar 
Sent: Tuesday, August 07, 2007 10:43 AM
To: 'commons-dev@jakarta.apache.org'
Subject: [DBCP] Connection gets blocked on 9th connection.

 

I am initializing the GeneriConnectionPool using the following
parameters

 

MaxActive=30

MaxIdle=20

MinIdle=20

MaxWait=1000

TestOnBorrow=true

ActionWhenExhasuted =2(GROW)

 

I try to test the connection pool by using the following code.

 

List<Connection> liCon = new ArrayList<Connection>(); 

 

for(i=0 ; i < 10 ; i++) {

      Connection oCon = oPool.getConnection();

      liCon.add(oCon);

}

 

The call to oPool.getConnection() gets blocked indefinitely when I try
to get the 9th connection.

 

Am I missing something?

Any ideas

 

Thanks

Tushar Dave

 

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message