You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Kavin Du (JIRA)" <ji...@apache.org> on 2008/12/31 21:05:44 UTC

[jira] Issue Comment Edited: (DBCP-233) Allow connection, statement, and result set to be closed multiple times

    [ https://issues.apache.org/jira/browse/DBCP-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660138#action_12660138 ] 

kavindu edited comment on DBCP-233 at 12/31/08 12:04 PM:
----------------------------------------------------------

One other repro case is if the underlying database connection is closed (listener bounced for example) from the database end, calling Connection.close() will result in:  

java.sql.SQLException: Attempted to use Connection after closed() was called.
        at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.assertOpen(ConnectionImpl.java:87)
        at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.close(ConnectionImpl.java:116)

The connection will stay in the the active pool, using up MaxActive.  We need to have it drop off from the pool if it's closed.  This is important as we want our application to automatically recover from a database failover and still have a accurate connection count. 

      was (Author: kavindu):
    One other repro case is if the underlying database connection is closed (listener bounced for example) from the database end, calling Connection.close() will result in:  

java.sql.SQLException: Attempted to use Connection after closed() was called.
        at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.assertOpen(ConnectionImpl.java:87)
        at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.close(ConnectionImpl.java:116)

The connection will stay in the the active pool, using up MaxActive.  We need to have it drop off from the pool if it's closed.
  
> Allow connection, statement, and result set to be closed multiple times
> -----------------------------------------------------------------------
>
>                 Key: DBCP-233
>                 URL: https://issues.apache.org/jira/browse/DBCP-233
>             Project: Commons Dbcp
>          Issue Type: Improvement
>            Reporter: Dain Sundstrom
>             Fix For: 1.3
>
>         Attachments: CloseTwice.patch
>
>
> This patch allows Connection, Statement, PreparedStatement, CallableStatement and ResultSet to be closed multiple times.  The first time close is called the resource is closed and any subsequent calls have no effect.  This behavior is required as per the JavaDocs for these classes.  The patch adds tests for closing all types multiple times and updates any tests that incorrectly assert that a resource can be closed more then once.
> This patch fixes DBCP-134 and DBCP-3

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.