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/datasources KeyedCPDSConnectionFactory.java
Date Sun, 07 Mar 2004 11:19:25 GMT
dirkv       2004/03/07 03:19:25

  Modified:    dbcp/src/java/org/apache/commons/dbcp/cpdsadapter
                        PooledConnectionImpl.java
               dbcp/src/java/org/apache/commons/dbcp/datasources
                        KeyedCPDSConnectionFactory.java
  Log:
  Bugzilla Bug 27465: Memory leak in KeyedCPDSConnectionFactory
  (Todd Carmichael)
  
  Revision  Changes    Path
  1.16      +6 -2      jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
  
  Index: PooledConnectionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PooledConnectionImpl.java	28 Feb 2004 21:58:38 -0000	1.15
  +++ PooledConnectionImpl.java	7 Mar 2004 11:19:25 -0000	1.16
  @@ -123,7 +123,11 @@
           } catch (Exception e) {
               throw new SQLNestedException("Cannot close connection (return to pool failed)",
e);
           } finally {
  -            connection.close();
  +            try {
  +                connection.close();
  +            } finally {
  +                connection = null;
  +            }
           }
       }
   
  
  
  
  1.6       +4 -2      jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java
  
  Index: KeyedCPDSConnectionFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/datasources/KeyedCPDSConnectionFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- KeyedCPDSConnectionFactory.java	28 Feb 2004 12:18:17 -0000	1.5
  +++ KeyedCPDSConnectionFactory.java	7 Mar 2004 11:19:25 -0000	1.6
  @@ -136,7 +136,9 @@
   
       public void destroyObject(Object key, Object obj) throws Exception {
           if (obj instanceof PooledConnectionAndInfo) {
  -            ((PooledConnectionAndInfo)obj).getPooledConnection().close();
  +            PooledConnection pc = ((PooledConnectionAndInfo)obj).getPooledConnection();
  +            pcMap.remove(pc);
  +            pc.close();
           }
       }
   
  
  
  

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