commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp PoolableConnection.java
Date Sat, 01 May 2004 12:50:13 GMT
dirkv       2004/05/01 05:50:13

  Modified:    dbcp/src/java/org/apache/commons/dbcp
                        PoolableConnection.java
  Log:
  Bugzilla Bug 28251:	Returning dead database connections to BasicDataSource
  - Fixed by catching the SQLException and invalidating the connection before rethrowing the
exception.
  
  Revision  Changes    Path
  1.14      +13 -2     jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/PoolableConnection.java
  
  Index: PoolableConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/PoolableConnection.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PoolableConnection.java	28 Feb 2004 12:18:17 -0000	1.13
  +++ PoolableConnection.java	1 May 2004 12:50:12 -0000	1.14
  @@ -62,7 +62,18 @@
        * Returns me to my pool.
        */
        public synchronized void close() throws SQLException {
  -        if(isClosed()) {
  +        boolean isClosed = false;
  +        try {
  +            isClosed = isClosed();
  +        } 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 (isClosed) {
               throw new SQLException("Already closed.");
           } else {
               try {
  
  
  

---------------------------------------------------------------------
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