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 33591] - [DBCP] Connection leak in PoolableConnection.close() (Oracle 10g driver)
Date Tue, 15 Feb 2005 17:49:36 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33591>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33591





------- Additional Comments From dirk.verbeeck@pandora.be  2005-02-15 18:49 -------
You want to invalidate the pooled connection if the underlying connection is
closed. Try the following PoolableConnection.close() method.

     public synchronized void close() throws SQLException {
        try {
            if (_conn.isClosed()) {
                // underlying connection closed behind our back
                try {
                    _pool.invalidateObject(this);
                } catch (Exception ie) {
                    // DO NOTHING
                }
                throw new SQLException("Cannot close connection (underlying
connection already closed)");
            }
        } catch (SQLException e) {
            try {
                _pool.invalidateObject(this);
            } catch (Exception ie) {
                // DO NOTHING the original exception will be rethrown
            }
            throw new SQLNestedException("Cannot close connection (isClosed
check failed)", e);
        }
        if (_closed) {
            throw new SQLException("Already closed.");
        } else {
            try {
                _pool.returnObject(this);
            } catch(SQLException e) {
                throw e;
            } catch(RuntimeException e) {
                throw e;
            } catch(Exception e) {
                throw new SQLNestedException("Cannot close connection (return to
pool failed)", e);
            }
        }
    }


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message