Andrea Aime ha scritto: ... >> But anyway, I'm fine if you apply the patch as is. It would be more or >> less temporary (unless the community decides otherwise) since I'm trying >> to adress those kind of issues since last week (I'm working on >> CRSAuthorityFactories right now) but the work still not ready for a >> merge. The approach I'm leading to is to close the connection after a >> much shorter timeout (so actually giving it back to the pool). In case >> we still have a connection lost, I'm tempted to make a second try after >> some kind of SQLException (so avoiding the cost of testing the >> connection in the common case where the connection still okay). > > Hum, interesting point. The issue I see is that we're doing the > connection validation, whilst the pool is not, so if we give back > the connection, the pool might return it back when we ask for > another one. I guess we need to have the pool do the validation > as well. > I have to double check, this might mean we need to add a DBCP dependency > on the actual modules so that we have a connection pool good enough to > actually validate the connections.
Ok, so I looked into the code a bit more and found out that neither of the HSQL/PostgreSQL data sources is pooling, they are just a man in the middle to build connections (I checked in the respective source codes, and in fact a DataSource is just mandated to provide connection, pooling is an extra behaviour that we don't actually need in this case, since we hold onto the connection ourselves). When the connection is closed, it's really closed, not returned to a pool. Anyways, it's good practice to close the connection, so I'll amend getConnection so that the connection is actually closed in case the validation fails. Thanks for spotting it. Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
