Hi all,
Just investigating what happens when you close a connection twice. At
the moment, nothing bad happens but you get a nasty warning message
like:
ConnectionPool.java:356) - Unable to set status of connection 40 from
ACTIVE to AVAILABLE. It remains AVAILABLE
We should obviously spot that. I'll have to check but I believe that is
okay to close() twice and if you do then it should do so silently.
It also got me thinking. I don't think we check the connection status
when using it. So it is quite possible to close the connection (i.e.
return it to the pool) and then keep on using it. This would be unwise.
Perhaps we should be throwing an exception if you try to do anything to
a connection that has been closed.
But then, what happens if someone else grabs that connection? Then two
"users" could be using the same one. I'm not sure how to avoid that
problem. Perhaps that is something that the user has to avoid.
Our goal is to behave exactly as if you were using the driver directly
without a pool. And in that scenario the driver would spot it happening
and throw an exception.
I can't think of a solution to this. Maybe it's just something to
document.
- Bill
|