commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: [dbpc-1.2.1 or pool-1.2] bug with invalid DB connection
Date Sat, 24 Jul 2004 11:41:53 GMT
You are right, the GenericKeyedObjectPool should behave more like the 
GenericObjectPool where the error handling is much better.

There is also a problem wit the GenericKeyedObjectPool if the 
activateObject throws an exception.

Ignoring the exception in destroyObject is a partial workaround.

Please create a bugzilla issue for GenericKeyedObjectPool in pool 
component and one for SharedPoolDataSource (with 
KeyedCPDSConnectionFactory) in DBCP component.

Thanks
Dirk

Vjeran Marcinko wrote:
> Hi folks.
> 
> I'm using GenericKeyedObjectPool and KeyedCPDSConnectionFactory.
> 
> As I see, pool should return db connection from borrowObject() method when
> it has been validated by validationQuery.
> But current situation is that when some connection proved to be *invalid* by
> this validation query, pool is trying to close this connection, and that
> raises IOException since this connection is invalid in first place, and pool
> doesn't ignore this exception but propagates it, instead to continue looping
> and searching for valid one (or creating new one).
> 
> Thus, it should be
> if(_testOnBorrow && !_factory.validateObject(key,pair.value)) {
>     try {
>     _factory.destroyObject(key,pair.value);
>     } catch (Exception ex) {
>     // ignore
>     }
> 
> inside borrowObject() in GenericKeyedObjectPool.
> Or this exception ca also be ignored in KeyedCPDSConnectionFactory's
> destroyObject()
> 
> Am I right ?
> 
> regards,
> Vjeran
> 
> 
> *****************
> Tis.kis d.o.o
> Heinzelova 33
> 10000 Zagreb, CROATIA
> URL: http://www.tiskis.com
> Phone: +385 91 2392624



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


Mime
View raw message