I think passivate() is called automatically when the connection is
put back in the pool (due to the _conn.close() call). I think there
are tests that check that the statements were closed when the
connection is closed.
Anyway, I don't think it is a big deal to call passivate twice. It
used to cause a SQLException because the delegating statements would
throw an exception on the second close.
-dain
On Jul 19, 2007, at 10:33 PM, Phil Steitz wrote:
Sorry I missed this in initial review. I am not sure we want to
remove the passivate() below, since that closes statements traced by
this connection. Am I missing something here?
Phil
jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/
DelegatingConnection.java
Tue Jul 17 23:46:16 2007
@@ -208,10 +208,17 @@
* Closes the underlying connection, and close
* any Statements that were not explicitly closed.
*/
- public void close() throws SQLException
- {
- passivate();
- _conn.close();
+ public void close() throws SQLException {
+ // close can be called multiple times, but
PoolableConnection improperly
+ // throws an exception when a connection is closed twice,
so before calling
+ // close we aren't alreayd closed
+ if (!isClosed()) {
+ try {
+ _conn.close();
+ } finally {
+ _closed = true;
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]