svn commit: r575396 - in /ofbiz/trunk/framework: entity/ entity/config/ entity/dtd/ entity/src/org/ofbiz/entity/config/ entity/src/org/ofbiz/entity/connection/ entity/src/org/ofbiz/entity/jdbc/ entity/src/org/ofbiz/entity/transaction/ geronimo/src/org/...

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

svn commit: r575396 - in /ofbiz/trunk/framework: entity/ entity/config/ entity/dtd/ entity/src/org/ofbiz/entity/config/ entity/src/org/ofbiz/entity/connection/ entity/src/org/ofbiz/entity/jdbc/ entity/src/org/ofbiz/entity/transaction/ geronimo/src/org/...

jaz-3
Author: jaz
Date: Thu Sep 13 11:32:31 2007
New Revision: 575396

URL: http://svn.apache.org/viewvc?rev=575396&view=rev
Log:
refactored entity engine factory and transaction factories to allow full configuration of managed connections through entityengine.xml. changed all connection factories to be instance objects (singleton pattern) implementing the new ConnectionFactoryInterface interface.

Two working connection factories are included now, Minerva and DBCP.

Minerva is still default until more testing can be done on DBCP; to change this use the DBCPConnectionFactory instead of MinervaConnection factory (see entityengine.xml)


Added:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java   (with props)
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java   (with props)
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java   (with props)
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java   (with props)
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java   (with props)
Removed:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DBCPConnectionFactory.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/MinervaConnectionFactory.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TyrexConnectionFactory.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/XaPoolConnectionFactory.java
Modified:
    ofbiz/trunk/framework/entity/build.xml
    ofbiz/trunk/framework/entity/config/entityengine.xml
    ofbiz/trunk/framework/entity/dtd/entity-config.xsd
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java
    ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java

Modified: ofbiz/trunk/framework/entity/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/build.xml?rev=575396&r1=575395&r2=575396&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/build.xml (original)
+++ ofbiz/trunk/framework/entity/build.xml Thu Sep 13 11:32:31 2007
@@ -82,7 +82,8 @@
                 <path refid="local.class.path"/>
             </classpath>
             <src path="${src.dir}"/>
-            <exclude name="org/ofbiz/entity/transaction/XaPoolConnectionFactory.java"/>
+            <exclude name="org/ofbiz/entity/connection/XaPoolConnectionFactory.java"/>
+            <exclude name="org/ofbiz/entity/connection/TyrexConnectionFactory.java"/>
         </javac>
         <copy todir="${build.dir}/classes">
             <!-- don't put the DTDs in the jar file... -->

Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=575396&r1=575395&r2=575396&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
+++ ofbiz/trunk/framework/entity/config/entityengine.xml Thu Sep 13 11:32:31 2007
@@ -29,6 +29,7 @@
     <!-- the transaction factory class to use, one is needed for each way of getting JTA interfaces -->
     <!-- Use this one for Geronimo -->
     <transaction-factory class="org.ofbiz.geronimo.GeronimoTransactionFactory"/>
+
     <!-- Use this one for getting the JTA objects from JNDI -->
     <!-- NOTE: to use the JndiFactory you must specify the necessary JNDI properties
     <transaction-factory class="org.ofbiz.entity.transaction.JNDIFactory">
@@ -44,6 +45,9 @@
         JBoss uses two different objects for the UserTransaction and TransactionManager interfaces;
         they are located in JNDI at: "java:comp/UserTransaction" and "java:/TransactionManager" respectively
     -->
+
+    <!-- the connection factory class to use, one is needed for obtaining connections/pools for defined resources -->
+    <connection-factory class="org.ofbiz.entity.connection.MinervaConnectionFactory"/>
 
     <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
         <group-map group-name="org.ofbiz" datasource-name="localderby"/>

Modified: ofbiz/trunk/framework/entity/dtd/entity-config.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/dtd/entity-config.xsd?rev=575396&r1=575395&r2=575396&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/dtd/entity-config.xsd (original)
+++ ofbiz/trunk/framework/entity/dtd/entity-config.xsd Thu Sep 13 11:32:31 2007
@@ -24,6 +24,7 @@
             <xs:sequence>
                 <xs:element maxOccurs="unbounded" ref="resource-loader"/>
                 <xs:element ref="transaction-factory"/>
+                <xs:element ref="connection-factory"/>
                 <xs:element maxOccurs="unbounded" ref="delegator"/>
                 <xs:element maxOccurs="unbounded" ref="entity-model-reader"/>
                 <xs:element maxOccurs="unbounded" ref="entity-group-reader"/>
@@ -74,6 +75,14 @@
     <xs:attributeGroup name="attlist.transaction-manager-jndi">
         <xs:attribute type="xs:string" name="jndi-server-name" use="required"/>
         <xs:attribute type="xs:string" name="jndi-name" use="required"/>
+    </xs:attributeGroup>
+    <xs:element name="connection-factory">
+        <xs:complexType>
+            <xs:attributeGroup ref="attlist.connection-factory"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:attributeGroup name="attlist.connection-factory">
+        <xs:attribute type="xs:string" name="class" use="required"/>
     </xs:attributeGroup>
     <xs:element name="delegator">
         <xs:complexType>

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java?rev=575396&r1=575395&r2=575396&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java Thu Sep 13 11:32:31 2007
@@ -48,6 +48,7 @@
     protected static String txFactoryUserTxJndiServerName;
     protected static String txFactoryTxMgrJndiName;
     protected static String txFactoryTxMgrJndiServerName;
+    protected static String connFactoryClass;
 
     protected static Map resourceLoaderInfos = FastMap.newInstance();
     protected static Map delegatorInfos = FastMap.newInstance();
@@ -92,6 +93,7 @@
     }
 
     public static void initialize(Element rootElement) throws GenericEntityException {
+        // load the transaction factory
         Element transactionFactoryElement = UtilXml.firstChildElement(rootElement, "transaction-factory");
         if (transactionFactoryElement == null) {
             throw new GenericEntityConfException("ERROR: no transaction-factory definition was found in " + ENTITY_ENGINE_XML_FILENAME);
@@ -117,6 +119,14 @@
             txFactoryTxMgrJndiServerName = null;
         }
 
+        // load the connection factory
+        Element connectionFactoryElement = UtilXml.firstChildElement(rootElement, "connection-factory");
+        if (connectionFactoryElement == null) {
+            throw new GenericEntityConfException("ERROR: no connection-factory definition was found in " + ENTITY_ENGINE_XML_FILENAME);
+        }
+
+        connFactoryClass = connectionFactoryElement.getAttribute("class");
+
         // not load all of the maps...
         List childElements = null;
         Iterator elementIter = null;
@@ -212,6 +222,10 @@
 
     public static String getTxFactoryTxMgrJndiServerName() {
         return txFactoryTxMgrJndiServerName;
+    }
+
+    public static String getConnectionFactoryClass() {
+        return connFactoryClass;
     }
 
     public static ResourceLoaderInfo getResourceLoaderInfo(String name) {

Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java?rev=575396&view=auto
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java (added)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java Thu Sep 13 11:32:31 2007
@@ -0,0 +1,16 @@
+package org.ofbiz.entity.connection;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.w3c.dom.Element;
+import org.ofbiz.entity.GenericEntityException;
+
+/**
+ * ConnectionFactoryInterface
+ */
+public interface ConnectionFactoryInterface {
+
+    public Connection getConnection(String helperName, Element configElement) throws SQLException, GenericEntityException;
+    public void closeAll();
+}

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ConnectionFactoryInterface.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 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=575396&view=auto
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (added)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Thu Sep 13 11:32:31 2007
@@ -0,0 +1,137 @@
+package org.ofbiz.entity.connection;
+
+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.XAConnectionFactory;
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.transaction.TransactionFactory;
+import org.w3c.dom.Element;
+
+import javax.transaction.TransactionManager;
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * DBCPConnectionFactory
+ */
+public class DBCPConnectionFactory implements ConnectionFactoryInterface {
+
+    public static final String module = DBCPConnectionFactory.class.getName();
+    protected static Map dsCache = new HashMap();
+
+    public Connection getConnection(String helperName, Element jotmJdbcElement) throws SQLException, GenericEntityException {
+        ManagedDataSource mds = (ManagedDataSource) dsCache.get(helperName);
+        if (mds != null) {
+            return TransactionFactory.getCursorConnection(helperName, mds.getConnection());
+        }
+
+        synchronized (DBCPConnectionFactory.class) {
+            mds = (ManagedDataSource) dsCache.get(helperName);
+            if (mds != null) {
+                return TransactionFactory.getCursorConnection(helperName, mds.getConnection());
+            }
+
+            // connection properties
+            TransactionManager txMgr = TransactionFactory.getTransactionManager();
+            String driverName = jotmJdbcElement.getAttribute("jdbc-driver");
+            String dbUri = jotmJdbcElement.getAttribute("jdbc-uri");
+            String dbUser = jotmJdbcElement.getAttribute("jdbc-username");
+            String dbPass = jotmJdbcElement.getAttribute("jdbc-password");
+
+            // pool settings
+            int maxSize, minSize;
+            try {
+                maxSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize"));
+            } catch (NumberFormatException nfe) {
+                Debug.logError("Problems with pool settings [pool-maxsize=" + jotmJdbcElement.getAttribute("pool-maxsize") + "]; the values MUST be numbers, using default of 20.", module);
+                maxSize = 20;
+            } catch (Exception e) {
+                Debug.logError(e, "Problems with pool settings", module);
+                maxSize = 20;
+            }
+            try {
+                minSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize"));
+            } catch (NumberFormatException nfe) {
+                Debug.logError("Problems with pool settings [pool-minsize=" + jotmJdbcElement.getAttribute("pool-minsize") + "]; the values MUST be numbers, using default of 5.", module);
+                minSize = 2;
+            } catch (Exception e) {
+                Debug.logError(e, "Problems with pool settings", module);
+                minSize = 2;
+            }
+            int maxIdle = maxSize / 2;
+            maxIdle = maxIdle > minSize ? maxIdle : minSize;
+
+            // load the driver
+            Driver jdbcDriver;
+            try {
+                jdbcDriver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).newInstance();
+            } catch (Exception e) {
+                Debug.logError(e, module);
+                throw new GenericEntityException(e.getMessage(), e);
+            }
+
+            // connection factory properties
+            Properties cfProps = new Properties();
+            cfProps.put("user", dbUser);
+            cfProps.put("password", dbPass);
+
+            // create the connection factory
+            ConnectionFactory cf = new DriverConnectionFactory(jdbcDriver, dbUri, cfProps);
+
+            // wrap it with a LocalXAConnectionFactory
+            XAConnectionFactory xacf = new LocalXAConnectionFactory(txMgr, cf);
+                                                
+            // configure the pool settings
+            GenericObjectPool pool = new GenericObjectPool();
+            pool.setTimeBetweenEvictionRunsMillis(600000);
+            pool.setMaxActive(maxSize);
+            pool.setMaxIdle(maxIdle);
+            pool.setMinIdle(minSize);
+            pool.setMaxWait(120000);
+
+
+            // create the pool object factory
+            PoolableConnectionFactory factory = new PoolableConnectionFactory(xacf, pool, null, null, true, true);
+            factory.setValidationQuery("select example_type_id from example_type limit 1");
+            factory.setDefaultReadOnly(false);
+
+            String transIso = jotmJdbcElement.getAttribute("isolation-level");
+            if (transIso != null && transIso.length() > 0) {
+                if ("Serializable".equals(transIso)) {
+                    factory.setDefaultTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
+                } else if ("RepeatableRead".equals(transIso)) {
+                    factory.setDefaultTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
+                } else if ("ReadUncommitted".equals(transIso)) {
+                    factory.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
+                } else if ("ReadCommitted".equals(transIso)) {
+                    factory.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+                } else if ("None".equals(transIso)) {
+                    factory.setDefaultTransactionIsolation(Connection.TRANSACTION_NONE);
+                }
+            }
+            pool.setFactory(factory);
+
+            mds = new ManagedDataSource(pool, xacf.getTransactionRegistry());
+            mds.setAccessToUnderlyingConnectionAllowed(true);
+
+            // cache the pool
+            dsCache.put(helperName, mds);
+
+            return TransactionFactory.getCursorConnection(helperName, mds.getConnection());
+        }
+    }
+
+    public void closeAll() {
+        // no methods on the pool to shutdown; so just clearing for GC
+        dsCache.clear();
+    }
+}

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java?rev=575396&view=auto
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java (added)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java Thu Sep 13 11:32:31 2007
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.entity.connection;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.transaction.TransactionFactory;
+import org.ofbiz.minerva.pool.jdbc.xa.XAPoolDataSource;
+import org.ofbiz.minerva.pool.jdbc.xa.wrapper.XADataSourceImpl;
+import org.w3c.dom.Element;
+
+/**
+ * MinervaConnectionFactory - Central source for Minerva JDBC Objects
+ */
+public class MinervaConnectionFactory implements ConnectionFactoryInterface {
+        
+    public static final String module = MinervaConnectionFactory.class.getName();
+    protected static Map dsCache = new HashMap();
+
+    public Connection getConnection(String helperName, Element jotmJdbcElement) throws SQLException, GenericEntityException {
+        XAPoolDataSource pds = (XAPoolDataSource) dsCache.get(helperName);        
+        if (pds != null) {                                  
+            return TransactionFactory.getCursorConnection(helperName, pds.getConnection());
+        }
+        
+        synchronized (MinervaConnectionFactory.class) {
+            pds = (XAPoolDataSource) dsCache.get(helperName);
+            if (pds != null) {                          
+                return pds.getConnection();
+            } else {
+                pds = new XAPoolDataSource();
+                pds.setPoolName(helperName);
+            }
+
+            XADataSourceImpl ds = new XADataSourceImpl();
+
+            if (ds == null)
+                throw new GenericEntityException("XADataSource was not created, big problem!");
+            
+            ds.setDriver(jotmJdbcElement.getAttribute("jdbc-driver"));
+            ds.setURL(jotmJdbcElement.getAttribute("jdbc-uri"));
+            
+            String transIso = jotmJdbcElement.getAttribute("isolation-level");
+            if (transIso != null && transIso.length() > 0) {
+                if ("Serializable".equals(transIso)) {
+                    pds.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
+                } else if ("RepeatableRead".equals(transIso)) {
+                    pds.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
+                } else if ("ReadUncommitted".equals(transIso)) {
+                    pds.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
+                } else if ("ReadCommitted".equals(transIso)) {
+                    pds.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+                } else if ("None".equals(transIso)) {
+                    pds.setTransactionIsolation(Connection.TRANSACTION_NONE);
+                }                                            
+            }
+            
+            // set the datasource in the pool            
+            pds.setDataSource(ds);
+            pds.setJDBCUser(jotmJdbcElement.getAttribute("jdbc-username"));
+            pds.setJDBCPassword(jotmJdbcElement.getAttribute("jdbc-password"));
+            
+            // set the transaction manager in the pool
+            pds.setTransactionManager(TransactionFactory.getTransactionManager());
+            
+            // configure the pool settings
+            try {            
+                pds.setMaxSize(Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize")));
+            } catch (NumberFormatException nfe) {
+                Debug.logError("Problems with pool settings [pool-maxsize=" + jotmJdbcElement.getAttribute("pool-maxsize") + "]; the values MUST be numbers, using default of 20.", module);
+                pds.setMaxSize(20);
+            } catch (Exception e) {
+                Debug.logError(e, "Problems with pool settings", module);
+                pds.setMaxSize(20);
+            }
+            try {            
+                pds.setMinSize(Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize")));
+            } catch (NumberFormatException nfe) {
+                Debug.logError("Problems with pool settings [pool-minsize=" + jotmJdbcElement.getAttribute("pool-minsize") + "]; the values MUST be numbers, using default of 5.", module);
+                pds.setMinSize(2);
+            } catch (Exception e) {
+                Debug.logError(e, "Problems with pool settings", module);
+                pds.setMinSize(2);
+            }
+                                  
+            // cache the pool
+            dsCache.put(helperName, pds);        
+                                                      
+            return TransactionFactory.getCursorConnection(helperName, pds.getConnection());
+        }                
+    }
+    
+    public void closeAll() {
+        Set cacheKeys = dsCache.keySet();
+        Iterator i = cacheKeys.iterator();
+        while (i.hasNext()) {
+            String helperName = (String) i.next();
+            XAPoolDataSource pds = (XAPoolDataSource) dsCache.remove(helperName);
+            pds.close();  
+        }                                                                            
+    }
+
+    // static methods for webtools
+    public static Set getPooledData(String helperName) throws GenericEntityException {
+        XAPoolDataSource pds = (XAPoolDataSource) dsCache.get(helperName);
+        if (pds == null) {
+            throw new GenericEntityException("No pool found for helper name [" + helperName + "]");
+        }
+        return pds.getPooledObjectRecords(0); // 0 to return all (in use and waiting)
+    }
+
+    public static String getPoolName(String helperName) throws GenericEntityException {
+        XAPoolDataSource pds = (XAPoolDataSource) dsCache.get(helperName);
+        if (pds == null) {
+            throw new GenericEntityException("No pool found for helper name [" + helperName + "]");
+        }
+        return pds.getPoolDataString();
+    }
+}

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java?rev=575396&view=auto
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java (added)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java Thu Sep 13 11:32:31 2007
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.entity.connection;
+
+//import java.util.*;
+//import java.sql.*;
+//import org.w3c.dom.Element;
+
+//import org.ofbiz.entity.*;
+//import org.ofbiz.base.util.*;
+
+// For Tyrex 0.9.8.5
+// import tyrex.resource.jdbc.xa.*;
+
+// For Tyrex 0.9.7.0
+// import tyrex.jdbc.xa.*;
+
+/**
+ * Tyrex ConnectionFactory - central source for JDBC connections from Tyrex
+ */
+public class TyrexConnectionFactory {
+    public static final String module = TyrexConnectionFactory.class.getName();
+}
+/*
+public class TyrexConnectionFactory {
+    public static final String module = TyrexConnectionFactory.class.getName();
+
+    // protected static UtilCache dsCache = new UtilCache("entity.TyrexDataSources", 0, 0);
+    protected static Map dsCache = new HashMap();
+
+    public static Connection getConnection(String helperName, Element inlineJdbcElement) throws SQLException, GenericEntityException {
+        boolean usingTyrex = true;
+
+        if (usingTyrex) {
+            EnabledDataSource ds;
+
+            // try once
+            ds = (EnabledDataSource) dsCache.get(helperName);
+            if (ds != null) {
+                return TransactionFactory.getCursorConnection(helperName, TransactionUtil.enlistConnection(ds.getXAConnection()));
+            }
+
+            synchronized (TyrexConnectionFactory.class) {
+                // try again inside the synch just in case someone when through while we were waiting
+                ds = (EnabledDataSource) dsCache.get(helperName);
+                if (ds != null) {
+                    return TransactionUtil.enlistConnection(ds.getXAConnection());
+                }
+
+                ds = new EnabledDataSource();
+                ds.setDriverClassName(inlineJdbcElement.getAttribute("jdbc-driver"));
+                ds.setDriverName(inlineJdbcElement.getAttribute("jdbc-uri"));
+                ds.setUser(inlineJdbcElement.getAttribute("jdbc-username"));
+                ds.setPassword(inlineJdbcElement.getAttribute("jdbc-password"));
+                ds.setDescription(helperName);
+
+                String transIso = inlineJdbcElement.getAttribute("isolation-level");
+
+                if (transIso != null && transIso.length() > 0)
+                    ds.setIsolationLevel(transIso);
+
+                ds.setLogWriter(Debug.getPrintWriter());
+
+                dsCache.put(helperName, ds);
+                return TransactionFactory.getCursorConnection(helperName, TransactionUtil.enlistConnection(ds.getXAConnection()));
+            }
+        }
+
+        return null;
+    }
+    
+    public static void closeAll() {
+        Set cacheKeys = dsCache.keySet();
+        Iterator i = cacheKeys.iterator();
+        while (i.hasNext()) {
+            String helperName = (String) i.next();
+            EnabledDataSource ed = (EnabledDataSource) dsCache.remove(helperName);
+            ed = null;  
+        }                                                                            
+    }  
+}
+*/
+

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java?rev=575396&view=auto
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java (added)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java Thu Sep 13 11:32:31 2007
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.entity.connection;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.enhydra.jdbc.pool.StandardXAPoolDataSource;
+import org.enhydra.jdbc.standard.StandardXADataSource;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.ObjectType;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.transaction.TransactionFactory;
+import org.w3c.dom.Element;
+
+/**
+ * JotmFactory - Central source for JOTM JDBC Objects
+ */
+public class XaPoolConnectionFactory {
+        
+    public static final String module = XaPoolConnectionFactory.class.getName();                
+        
+    protected static Map dsCache = new HashMap();
+    
+    public static Connection getConnection(String helperName, Element jotmJdbcElement) throws SQLException, GenericEntityException {                              
+        StandardXAPoolDataSource pds = (StandardXAPoolDataSource) dsCache.get(helperName);        
+        if (pds != null) {                      
+            if (Debug.verboseOn()) Debug.logVerbose(helperName + " pool size: " + pds.pool.getCount(), module);          
+            return TransactionFactory.getCursorConnection(helperName, pds.getConnection());
+        }
+        
+        synchronized (XaPoolConnectionFactory.class) {            
+            pds = (StandardXAPoolDataSource) dsCache.get(helperName);
+            if (pds != null) {                          
+                return pds.getConnection();
+            }
+            
+            // the xapool wrapper class
+            String wrapperClass = jotmJdbcElement.getAttribute("pool-xa-wrapper-class");
+            
+            StandardXADataSource ds = null;        
+            try {            
+                //ds =  new StandardXADataSource();                
+                ds = (StandardXADataSource) ObjectType.getInstance(wrapperClass);
+                pds = new StandardXAPoolDataSource();
+            } catch (NoClassDefFoundError e) {                
+                throw new GenericEntityException("Cannot find xapool.jar");                      
+            } catch (ClassNotFoundException e) {
+                throw new GenericEntityException("Cannot load wrapper class: " + wrapperClass, e);                
+            } catch (InstantiationException e) {
+                throw new GenericEntityException("Unable to instantiate " + wrapperClass, e);                
+            } catch (IllegalAccessException e) {
+                throw new GenericEntityException("Problems getting instance of " + wrapperClass, e);                
+            }
+            
+            if (ds == null)
+                throw new GenericEntityException("StandardXaDataSource was not created, big problem!");
+            
+            ds.setDriverName(jotmJdbcElement.getAttribute("jdbc-driver"));
+            ds.setUrl(jotmJdbcElement.getAttribute("jdbc-uri"));
+            ds.setUser(jotmJdbcElement.getAttribute("jdbc-username"));
+            ds.setPassword(jotmJdbcElement.getAttribute("jdbc-password"));
+            ds.setDescription(helperName);  
+            ds.setTransactionManager(TransactionFactory.getTransactionManager());
+            
+            String transIso = jotmJdbcElement.getAttribute("isolation-level");
+            if (transIso != null && transIso.length() > 0) {
+                if ("Serializable".equals(transIso)) {
+                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
+                } else if ("RepeatableRead".equals(transIso)) {
+                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
+                } else if ("ReadUncommitted".equals(transIso)) {
+                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
+                } else if ("ReadCommitted".equals(transIso)) {
+                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+                } else if ("None".equals(transIso)) {
+                    ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_NONE);
+                }                                            
+            }
+            
+            // set the datasource in the pool            
+            pds.setDataSource(ds);
+            pds.setDescription(ds.getDescription());
+            pds.setUser(ds.getUser());
+            pds.setPassword(ds.getPassword());
+            Debug.logInfo("XADataSource: " + ds.getClass().getName() + " attached to pool.", module);
+            
+            // set the transaction manager in the pool
+            pds.setTransactionManager(TransactionFactory.getTransactionManager());
+            
+            // configure the pool settings          
+            try {            
+                pds.setMaxSize(new Integer(jotmJdbcElement.getAttribute("pool-maxsize")).intValue());
+                pds.setMinSize(new Integer(jotmJdbcElement.getAttribute("pool-minsize")).intValue());
+                pds.setSleepTime(new Long(jotmJdbcElement.getAttribute("pool-sleeptime")).longValue());
+                pds.setLifeTime(new Long(jotmJdbcElement.getAttribute("pool-lifetime")).longValue());
+                pds.setDeadLockMaxWait(new Long(jotmJdbcElement.getAttribute("pool-deadlock-maxwait")).longValue());
+                pds.setDeadLockRetryWait(new Long(jotmJdbcElement.getAttribute("pool-deadlock-retrywait")).longValue());
+                
+                // set the test statement to test connections
+                String testStmt = jotmJdbcElement.getAttribute("pool-jdbc-test-stmt");
+                if (testStmt != null && testStmt.length() > 0) {
+                    pds.setJdbcTestStmt(testStmt);
+                    Debug.logInfo("Set JDBC Test Statement : " + testStmt, module);
+                }                
+            } catch (NumberFormatException nfe) {
+                Debug.logError(nfe, "Problems with pool settings; the values MUST be numbers, using defaults.", module);
+            } catch (Exception e) {
+                Debug.logError(e, "Problems with pool settings", module);
+            }
+                                  
+            // cache the pool
+            dsCache.put(helperName, pds);        
+                                                      
+            return TransactionFactory.getCursorConnection(helperName, pds.getConnection());
+        }                
+    }
+    
+    public static void closeAll() {
+        Set cacheKeys = dsCache.keySet();
+        Iterator i = cacheKeys.iterator();
+        while (i.hasNext()) {
+            String helperName = (String) i.next();
+            StandardXAPoolDataSource pds = (StandardXAPoolDataSource) dsCache.remove(helperName);
+            pds.shutdown(true);  
+        }                                                                            
+    }
+}

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java?rev=575396&r1=575395&r2=575396&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java Thu Sep 13 11:32:31 2007
@@ -18,19 +18,19 @@
  *******************************************************************************/
 package org.ofbiz.entity.jdbc;
 
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.connection.ConnectionFactoryInterface;
+import org.ofbiz.entity.transaction.TransactionFactory;
+import org.w3c.dom.Element;
+
 import java.sql.Connection;
 import java.sql.Driver;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 import java.util.Properties;
 
-import org.w3c.dom.Element;
-
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.transaction.MinervaConnectionFactory;
-import org.ofbiz.entity.transaction.TransactionFactory;
-
 /**
  * ConnectionFactory - central source for JDBC connections
  *
@@ -38,6 +38,7 @@
 public class ConnectionFactory {
     // Debug module name
     public static final String module = ConnectionFactory.class.getName();
+    private static ConnectionFactoryInterface _factory = null;
 
     public static Connection getConnection(String driverName, String connectionUrl, Properties props, String userName, String password) throws SQLException {
         // first register the JDBC driver with the DriverManager
@@ -75,58 +76,60 @@
         }
         return con;
     }
-    
-    public static Connection tryGenericConnectionSources(String helperName, Element inlineJdbcElement) throws SQLException, GenericEntityException {
-        // Minerva Based
-        try {
-            Connection con = MinervaConnectionFactory.getConnection(helperName, inlineJdbcElement);
-            if (con != null) return con;
-        } catch (Exception ex) {
-            Debug.logError(ex, "There was an error getting a Minerva datasource.", module);
-        }
 
-        /* DEJ20040103 XAPool still seems to have some serious issues and isn't working right, of course we may not be using it right, but I don't really feel like trying to track it down now
-        // XAPool & JOTM Based
-        try {
-            Connection con = XaPoolConnectionFactory.getConnection(helperName, inlineJdbcElement);
-            if (con != null) return con;
-        } catch (Exception ex) {
-            Debug.logError(ex, "There was an error getting a Minerva datasource.", module);
-        }
-        */
+    @Deprecated
+    public static Connection tryGenericConnectionSources(String helperName, Element inlineJdbcElement) throws SQLException, GenericEntityException {
+        return getManagedConnectionFactory().getConnection(helperName, inlineJdbcElement);
+    }
 
-        /* DEJ20050103 This pretty much never works anyway, so leaving out to reduce error messages when things go bad
-        // next try DBCP
-        try {
-            Connection con = DBCPConnectionFactory.getConnection(helperName, inlineJdbcElement);
-            if (con != null) return con;
-        } catch (Exception ex) {
-            Debug.logError(ex, "There was an error getting a DBCP datasource.", module);
-        }
-        
-        // Default to plain JDBC.
-        String driverClassName = inlineJdbcElement.getAttribute("jdbc-driver");
-        if (driverClassName != null && driverClassName.length() > 0) {
-            try {
-                ClassLoader loader = Thread.currentThread().getContextClassLoader();
-                Class clazz = loader.loadClass(driverClassName);
-                clazz.newInstance();
-            } catch (ClassNotFoundException e) {
-                Debug.logWarning(e, "Could not find JDBC driver class named " + driverClassName, module);
-                return null;
-            } catch (java.lang.IllegalAccessException e) {
-                Debug.logWarning(e, "Not allowed to access JDBC driver class named " + driverClassName, module);
-                return null;
-            } catch (java.lang.InstantiationException e) {
-                Debug.logWarning(e, "Could not create new instance of JDBC driver class named " + driverClassName, module);
-                return null;
+    public static ConnectionFactoryInterface getManagedConnectionFactory() {
+        if (_factory == null) { // don't want to block here
+            synchronized (TransactionFactory.class) {
+                // must check if null again as one of the blocked threads can still enter
+                if (_factory == null) {
+                    try {
+                        String className = EntityConfigUtil.getConnectionFactoryClass();
+
+                        if (className == null) {
+                            throw new IllegalStateException("Could not find connection factory class name definition");
+                        }
+                        Class cfClass = null;
+
+                        if (className != null && className.length() > 0) {
+                            try {
+                                ClassLoader loader = Thread.currentThread().getContextClassLoader();
+                                cfClass = loader.loadClass(className);
+                            } catch (ClassNotFoundException e) {
+                                Debug.logWarning(e, module);
+                                throw new IllegalStateException("Error loading ConnectionFactoryInterface class \"" + className + "\": " + e.getMessage());
+                            }
+                        }
+
+                        try {
+                            _factory = (ConnectionFactoryInterface) cfClass.newInstance();
+                        } catch (IllegalAccessException e) {
+                            Debug.logWarning(e, module);
+                            throw new IllegalStateException("Error loading ConnectionFactoryInterface class \"" + className + "\": " + e.getMessage());
+                        } catch (InstantiationException e) {
+                            Debug.logWarning(e, module);
+                            throw new IllegalStateException("Error loading ConnectionFactoryInterface class \"" + className + "\": " + e.getMessage());
+                        }
+                    } catch (SecurityException e) {
+                        Debug.logError(e, module);
+                        throw new IllegalStateException("Error loading ConnectionFactoryInterface class: " + e.getMessage());
+                    }
+                }
             }
-            return DriverManager.getConnection(inlineJdbcElement.getAttribute("jdbc-uri"),
-                    inlineJdbcElement.getAttribute("jdbc-username"), inlineJdbcElement.getAttribute("jdbc-password"));
         }
-        */
+        return _factory;    
+    }
+
+    public static Connection getManagedConnection(String helperName, Element inlineJdbcElement) throws SQLException, GenericEntityException {
+        return getManagedConnectionFactory().getConnection(helperName, inlineJdbcElement);
+    }
 
-        return null;
+    public static void closeAllManagedConnections() {
+        getManagedConnectionFactory().closeAll();
     }
 
     public static void loadDriver(String driverName) throws SQLException {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java?rev=575396&r1=575395&r2=575396&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/DumbFactory.java Thu Sep 13 11:32:31 2007
@@ -110,7 +110,7 @@
         DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName);
 
         if (datasourceInfo.inlineJdbcElement != null) {
-            Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement);
+            Connection otherCon = ConnectionFactory.getManagedConnection(helperName, datasourceInfo.inlineJdbcElement);
             return TransactionFactory.getCursorConnection(helperName, otherCon);
         } else {
             Debug.logError("Dumb/Empty is the configured transaction manager but no inline-jdbc element was specified in the " + helperName + " datasource. Please check your configuration", module);

Modified: ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java?rev=575396&r1=575395&r2=575396&view=diff
==============================================================================
--- ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java (original)
+++ ofbiz/trunk/framework/geronimo/src/org/ofbiz/geronimo/GeronimoTransactionFactory.java Thu Sep 13 11:32:31 2007
@@ -38,7 +38,6 @@
 import org.ofbiz.entity.config.DatasourceInfo;
 import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.jdbc.ConnectionFactory;
-import org.ofbiz.entity.transaction.MinervaConnectionFactory;
 import org.ofbiz.entity.transaction.TransactionFactoryInterface;
 
 /**
@@ -90,15 +89,7 @@
         DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName);
 
         if (datasourceInfo != null && datasourceInfo.inlineJdbcElement != null) {
-            try {
-                Connection con = MinervaConnectionFactory.getConnection(helperName, datasourceInfo.inlineJdbcElement);
-                if (con != null) return con;
-            } catch (Exception ex) {
-                Debug.logError(ex, "Geronimo is the configured transaction manager but there was an error getting a database Connection through Geronimo for the " + helperName + " datasource. Please check your configuration, class path, etc.", module);
-            }
-        
-            Connection otherCon = ConnectionFactory.tryGenericConnectionSources(helperName, datasourceInfo.inlineJdbcElement);
-            return otherCon;
+            return ConnectionFactory.getManagedConnection(helperName, datasourceInfo.inlineJdbcElement);                        
         } else {            
             Debug.logError("Geronimo is the configured transaction manager but no inline-jdbc element was specified in the " + helperName + " datasource. Please check your configuration", module);
             return null;
@@ -106,7 +97,7 @@
     }
     
     public void shutdown() {
-        MinervaConnectionFactory.closeAll();
+        ConnectionFactory.closeAllManagedConnections();
         if (transactionContextManager != null) {
             // TODO: need to do anything for this?
             transactionContextManager = null;