Author: jleroux
Date: Thu Jun 16 12:13:02 2016
New Revision: 1748693
URL: http://svn.apache.org/viewvc?rev=1748693&view=rev
Log:
Fixes "The Connection Pool Status feature in webtools is broken" -
https://issues.apache.org/jira/browse/OFBIZ-7363
Completes the work I did in r1748689. Actually I worked on different editors
and mixed things so not all was committed previously, here they are
Removes now useless commented out line about DebugManagedDataSource (// Useful
to debug the usage of connections in the pool). I put more information in the
class head while fixing the type warnings
Fixes other type warnings I missed previously
Eventually removes the old comment
// Hmm... then how do we close the JDBC connections?
Because "we" don't close JDBC connections, DBPC takes care of that (or at least
should, I did not check).
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=1748693&r1=1748692&r2=1748693&view=diff
==============================================================================
---
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
(original)
+++
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
Thu Jun 16 12:13:02 2016
@@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentHa
import javax.transaction.TransactionManager;
import org.apache.commons.dbcp2.DriverConnectionFactory;
+import org.apache.commons.dbcp2.PoolableConnection;
import org.apache.commons.dbcp2.PoolableConnectionFactory;
import org.apache.commons.dbcp2.managed.LocalXAConnectionFactory;
import org.apache.commons.dbcp2.managed.PoolableManagedConnectionFactory;
@@ -53,6 +54,8 @@ import org.ofbiz.entity.transaction.Tran
public class DBCPConnectionFactory implements ConnectionFactory {
public static final String module = DBCPConnectionFactory.class.getName();
+ // ManagedDataSource is useful to debug the usage of connections in the
pool (must be verbose)
+ // In case you don't want to be disturbed in the log (focusing on
something else), it's still easy to comment out the line from
DebugManagedDataSource
protected static final ConcurrentHashMap<String, DebugManagedDataSource>
dsCache = new ConcurrentHashMap<String, DebugManagedDataSource>();
public Connection getConnection(GenericHelperInfo helperInfo, JdbcElement
abstractJdbc) throws SQLException, GenericEntityException {
@@ -140,11 +143,10 @@ public class DBCPConnectionFactory imple
poolConfig.setTestOnReturn(jdbcElement.getTestOnReturn());
poolConfig.setTestWhileIdle(jdbcElement.getTestWhileIdle());
- GenericObjectPool pool = new GenericObjectPool(factory, poolConfig);
+ GenericObjectPool<PoolableConnection> pool = new
GenericObjectPool<PoolableConnection>(factory, poolConfig);
factory.setPool(pool);
mds = new DebugManagedDataSource(pool, xacf.getTransactionRegistry());
- //mds = new DebugManagedDataSource(pool,
xacf.getTransactionRegistry()); // Useful to debug the usage of connections in
the pool
mds.setAccessToUnderlyingConnectionAllowed(true);
// cache the pool
@@ -156,7 +158,6 @@ public class DBCPConnectionFactory imple
public void closeAll() {
// no methods on the pool to shutdown; so just clearing for GC
- // Hmm... then how do we close the JDBC connections?
dsCache.clear();
}