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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to