svn commit: r1431193 - in /ofbiz/branches/release12.04: ./ framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1431193 - in /ofbiz/branches/release12.04: ./ framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java

jleroux@apache.org
Author: jleroux
Date: Thu Jan 10 05:38:26 2013
New Revision: 1431193

URL: http://svn.apache.org/viewvc?rev=1431193&view=rev
Log:
"Applied fix from trunk for revision: 1431191"
------------------------------------------------------------------------
r1431191 | jleroux | 2013-01-10 06:32:48 +0100 (jeu., 10 janv. 2013) | 10 lines

In "Memory leak due to transaction management using DBCP and MySQL" https://issues.apache.org/jira/browse/OFBIZ-5122 Jose Manuel Vivó Arnal reported that I missed to apply the patch from OFBIZ-2599, just handled the DBPC part, and Philippe Mouawad did not notice.

OK, so it was just a matter of replacing
PoolableConnectionFactory factory = new PoolableConnectionFactory(xacf, pool, null, null, true, true);
by
PoolableManagedConnectionFactory factory = new PoolableManagedConnectionFactory(xacf, pool, null, null, true, true);

The rest are only imports cleaning.

Too bad we did not notice that for 3.5 years. It seems it does not affect servers with plenty of memory, or updated often enough. But I recommend to upgrade of course...
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release12.04/   (props changed)
    ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java

Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1431191

Modified: ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=1431193&r1=1431192&r2=1431193&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original)
+++ ofbiz/branches/release12.04/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Thu Jan 10 05:38:26 2013
@@ -18,11 +18,22 @@
  *******************************************************************************/
 package org.ofbiz.entity.connection;
 
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.transaction.TransactionManager;
+
+import javolution.util.FastMap;
+
 import org.apache.commons.dbcp.ConnectionFactory;
 import org.apache.commons.dbcp.DriverConnectionFactory;
-import org.apache.commons.dbcp.PoolableConnectionFactory;
 import org.apache.commons.dbcp.managed.LocalXAConnectionFactory;
 import org.apache.commons.dbcp.managed.ManagedDataSource;
+import org.apache.commons.dbcp.managed.PoolableManagedConnectionFactory;
 import org.apache.commons.dbcp.managed.XAConnectionFactory;
 import org.apache.commons.pool.impl.GenericObjectPool;
 import org.ofbiz.base.util.Debug;
@@ -145,7 +156,7 @@ public class DBCPConnectionFactory imple
 
 
             // create the pool object factory
-            PoolableConnectionFactory factory = new PoolableConnectionFactory(xacf, pool, null, null, true, true);
+            PoolableManagedConnectionFactory factory = new PoolableManagedConnectionFactory(xacf, pool, null, null, true, true);
             factory.setValidationQuery("select example_type_id from example_type limit 1");
             factory.setDefaultReadOnly(false);