> GenericDataSource Improvements. Improve the connection pool
> implementation by including checking for dead connections before a
> connection is returned. (The means used for checking needs to be
> configurable somehow).
FYI, the pooling stuff I submitted yesterday supports this, (by setting the "test on borrow" attribute to true). To check a connection, it attempts to execute a query on it. There was some talk on this list a while back about a simpler test, like just checking if Connection.isClosed method, but it's not clear to me that that will work. If the database times out a Connection or if it otherwise becomes invalid, will isClosed return true, or is isClosed just reporting whether or not the close() method has been invoked?
In my experience (your mileage my vary) the overhead of checking every connection before borrowing it from the pool isn't worth the benefit. Rather, it is more effective to periodically check the connections as they sit idle in the pool. This picks up what is probably the most common cause for an invalid connection (database dropping the connection due to inactivity) as well as hedging against the other common cause (database bounced). The pooling stuff I submitted yesterday also supports this functionality.
- rlw