-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Mark,

On 4/30/13 8:22 AM, Mark Thomas wrote:
> On 30/04/2013 12:59, Jose María Zaragoza wrote:
>> Hello:
>> 
>> I'm using Tomcat 6.0.23 I'm using DBCP library to pooling
>> database connections.
>> 
>> When I define a <Resource> in context.xml and set  maxWait to
>> 2000 ms , sometimes datasource.getConnection() method lasts 15
>> seconds.
>> 
>> I've to define loginTimeout parameter in JDBC driver to get the
>> effect that I want  : a timeout retrieving a Connection
>> 
>> What is the meaning of maxWait ? When is triggered this timeout
>> (maxWait) ?
> 
> maxWait is the maximum time DBCP will wait for a connection to
> become available if the pool is at full capacity (i.e. all
> permitted connections have been created and are currently allocated
> to other clients).
> 
> In your case, no connection is available and there is still spare 
> capacity in the pool so a new connection is created. That will take
> as long as it takes. Tomcat & DBCP have no control over it.

Sounds like a resource limit in the db side. If you have, say,
maxActive="10" but your database only allows you to have 5 concurrent
connections, then your pool will essentially max-out at 5 connections
and the 6th connection will wait potentially forever to connect (if
that's the behavior of the server, which seems like an odd way to
behave rather than just rejecting the connection). I suppose it's
possible that, given a connection-failure, dbcp retries the connection
and just fails over and over. But then I'd expect it to a) give up
after a while with an exception or b) never connect, since there are 5
existing connections.

Good to know that maxWait only applies when waiting for a connection
from the existing pool and not when a new connection is being attempted.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRf9qeAAoJEBzwKT+lPKRY90cP+gOykLSKfROhubEFTTDmkKHu
2pDAkI1YxgDTEPub7CMHS8OXiR77FwyKyrdjfrbEQ+0X09gH8FrbOefHohe4vpT7
QsmL+YKuR2cMZHBBnNCDdorQvT/csctbNsM0SbV9d2ajW1b8GtmMSugM6dBw1ot5
SsH7o/czrQ1FcCr/GrL8OXnBhwmH5bblNfIeQIvFDPselt44Q5sXytEo9Sw/we5E
3GD4s/18m/o0nFBcJ5QiAtVlGu7ZjGQVfJB+ydu7PLjZDWfSZl4mY1qSQoMBdPzM
vVgBZ3O68UekHH/cU6DuSBWPaqa1Ue2J72BRXRkM62r5VvzMJRakJU8zzWQofWmL
KbyEfNKapK4LY9wKPg7tjQpKJltUk2jjtbPgpC2bILISl7sGegkSed22bE0L4Zhc
6SvmGms7YyWB0H0xmk21PaY3vcF5+uLmyCccfLNnZThqKHmwwDLeYiGm3DSbFpRn
Wm2yNn07eeW8IYrvx+tMg9PZYw+IyjlESjIwWOx08/zJ9Ubw5TknqB00g3eD8eWh
7lbQNesaVuhBfQ9omcbBbmuyCKUGUGlEuLYdEhN2pXHBiXVzzEocZ5rg5MACJ4Iq
k2LVw80QcFdLcgKPeYmovWNkvydaATR5HUXdBd70yYdBIYvx6hy6ZcDvK/AyR8YW
OWBKrlWot3ZiK9CxWSVl
=b0eN
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to