commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <>
Subject Re: [dbcp] Re: WAITING on lock=org.apache.commons.pool.impl.GenericObjectPool
Date Sat, 26 Apr 2008 21:31:07 GMT
On Sat, Apr 26, 2008 at 2:57 AM, Philip Arad <> wrote:
> Hi
>  Thanks for your help.
>  You are right, I am using commons-pool-1.4.jar.
>  First I have setup the numbers of concurrent threads to 8, an ran the
> program
>  several times. It is executing correctly.
>  Then I have setup the following attributes on BasicDataSource:
>        vBDS.setMaxActive(400);
>        vBDS.setMinIdle(0);
>        vBDS.setMaxWait(3000L);
>  And set up the numbers of concurrent threads to 10.
>  After running it again, I had to same problem.
>  It seems like the setting of the attributes did not effect the
> configuration
>  of the BasicDataSource.
>  Are there any parameters to setup on the PoolingDataSource?
>  Is it possible that the connections are not returned to the pool after
> being
>  closed?

Sorry, I had not looked carefully at the code in your initial post.
Unless you want two layers of pooling for some reason, there is no
need to wrap the BasicDataSource in a PoolingDataSource as you are
doing here:

// Create a PoolableDataSource
ObjectPool vConnectionPool = new GenericObjectPool(null);
ConnectionFactory vConnectionFactory = new DataSourceConnectionFactory(vBDS);

Normally, you should be able to just return the BasicDataSource, vBDS,
which already has a connection pool associated with it.
Alternatively, you could create your own PoolingDataSource using a
Driver- or DriverManagerConnectionFactory.  See the examples linked on
the DBCP web page (ManualPoolingDataSourceExample,

The maxActive and maxWait properties are poperties of the underlying
object pool.  BasicDataSource exposes these properties via getters and
setters and creates a PoolingDataSource to source connections from the
pool.  When you create a PoolingDataSource manually, you need to set
the properties on the object pool directly.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message