commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <phil.ste...@gmail.com>
Subject [dbcp] Re: WAITING on lock=org.apache.commons.pool.impl.GenericObjectPool
Date Sat, 26 Apr 2008 06:25:03 GMT
On Fri, Apr 25, 2008 at 7:27 PM, Philip Arad <philip_arad@datatex.it> wrote:
> Hi
>
>  I am using commons-pool-1.3.jar with commons-dbcp-1.2.2.jar.

Stack trace looks like pool 1.4, which is the latest release.

>  My program is using concurrent threads that each of them access the DB
> through
>  BasicDataSource. If I use 5 concurrent threads, the program is running
> without
>  any problem. The problem starts when I am using 10 threads:
>  Each thread is using the class ConnectionHelper to get a connection to the
> DB:
>
<snip/>

> ------------------------------------------------------------------------------------
>  "Thread-4" Id=14 in WAITING on
> lock=org.apache.commons.pool.impl.GenericObjectPool@18a80d4
>    at java.lang.Object.wait(Native Method)
>    at java.lang.Object.wait(Object.java:485)
>    at
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:942)
>    at
> org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
>    at
> dataAccess.util.ConnectionHelper.getConnection(ConnectionHelper.java:37)
>      - locked java.lang.Class@99d56b
>    at
> dataAccess.util.DataAccessLocalImpl.getConnection(DataAccessLocalImpl.java:25)
>    at dataAccess.db.BaseDataAccess.getFullColumns(BaseDataAccess.java:1284)
>    at dataAccess.db.BaseDataAccess.getFullColumns(BaseDataAccess.java:1272)
>    at
> dataAccess.util.CreateStatement.createStatement(CreateStatement.java:63)
>    at dataAccess.util.CreateStatement.process(CreateStatement.java:48)
>    at
> dataAccess.db.thread.query.QueryRunnerThread.run(QueryRunnerThread.java:19)
>
> ------------------------------------------------------------------------------------
>
>  Can you tell me what should I do to solve this problem?

The thread above is waiting for a connection to become available.  The
default maxActive setting of BasicDataSource is 8, so if you want to
have more than 8 connections concurrently in use, you need to increase
this.  See the BasicDataSource javadoc.   See also the maxWait
property if you would prefer getConnection to time out and throw an
exception when there are no idle connections available.

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message