If I accidentally close DBCP connections twice, it will eventually cause the
JNDI datasource to start returning connections that are already closed.
Essentially my problem is this:
while (true)
{
DataSource ds = getDataSourceFromJNDI();
Connection conn = ds.getConnection();
PreparedStatement ps = conn.prepareStatement("SELECT * FROM ......");
ResultSet rs = ps.executeQuery();
rs.close();
ps.close();
conn.close();
// make the mistake of closing it twice
conn.close();
}
Eventually getDataSourceFromJNDI() returns me a connection that's already
closed. In fact both it, and it's delegate, have the same object reference
IDs as the connections returned by the previous call.
This only happens if I use the connection to do something, and not if I just
create it and then close it.
I can always just wrap the connection in a proxy and then just not forward
on the close call if it's already been closed, but I figure that someone out
there might want to fix this properly and I can't find where I'm supposed to
commit bugs.
This sort of problem is best described in code, so I'm attaching it below.
It's a simple enough servlet that exposes this problem.
from me, daniel.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]