mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r729495 - /mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java
Date Fri, 26 Dec 2008 13:34:39 GMT
Author: dlat
Date: Fri Dec 26 05:34:39 2008
New Revision: 729495

URL: http://svn.apache.org/viewvc?rev=729495&view=rev
Log:
FTPServer-249 DBUserManager doesn't close Connections leading to pool exhaustion.

Modified:
    mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java?rev=729495&r1=729494&r2=729495&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java
(original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/usermanager/impl/DbUserManager.java
Fri Dec 26 05:34:39 2008
@@ -433,11 +433,17 @@
 
     private void closeQuitely(Statement stmt) {
         if(stmt != null) {
-            try {
+	    Connection con = null;
+	    try {
+		con = stmt.getConnection();
+	    } catch (Exception e) {
+	    }
+	    try {
                 stmt.close();
             } catch (SQLException e) {
                 // ignore
             }
+	    closeQuitely(con);
         }
     }
 
@@ -450,7 +456,16 @@
             }
         }
     }
-
+    
+    private void closeQuitely(Connection con) {
+	if (con != null) {
+	    try {
+		con.close();
+	    } catch (SQLException e) {
+		// ignore
+	    }
+	}
+    }
     
     private BaseUser selectUserByName(String name) throws SQLException {
         // create sql query



Mime
View raw message