commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23185] - PoolableConnection.close() won't allow multiple close
Date Mon, 22 Sep 2003 03:19:05 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23185>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23185

PoolableConnection.close() won't allow multiple close





------- Additional Comments From adam@thejenkins.org  2003-09-22 03:19 -------
For evidence that Connection.close() shouldn't throw an exception just because   the connection
is already closed, see Sun's API spec for the Connction.close()   method.      http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Connection.html#close()
     The relevent quote is: "Calling the method close on a Connection object that   is already
closed is a no-op."  That makes it pretty clear to me that the   PoolableConnection.close
implementation is not what the spec intended in this  regard.      Note, I can well believe
that the current behaviour was intended, and I think  good arguments can be made for the spec's
behaviour and for  PoolableConnection's behaviour.  However, I don't think there's any great
 advantage to either implementation, so I think the spec should win out.    I found this problem
because we actually had code which called close twice; once when the connection was done being
used, and later in the finally block in case there was an error before the normal close. 
We were using DriverManager but recently decided to use connection pooling, and so switched
to commons-dbcp and started getting exceptions.  If I'd written the code, I wouldn't have
called Connection.close twice anyway, but I can't really fault the original programmer since
he was following Sun's spec, so I must fault the PoolableConnection implementation.

Mime
View raw message