User: mulder
Date: 00/08/31 09:37:09
Modified: src/main/org/jboss/minerva/factories
JDBCConnectionFactory.java
Log:
Bring non-transactional JDBC pool up to snuff. Unlikely you'll ever use
the jBoss MBean, but it least it works the same (parameters in the
jboss.jcml file, etc.). The JDBC pool itself will clear out cached
PreparedStatements when the connections are closed.
Minor bugfix in the transactional implementation - correctly return JDBC
connection properties (also not generally used).
Revision Changes Path
1.4 +16 -1
jboss/src/main/org/jboss/minerva/factories/JDBCConnectionFactory.java
Index: JDBCConnectionFactory.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/factories/JDBCConnectionFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JDBCConnectionFactory.java 2000/08/18 03:21:08 1.3
+++ JDBCConnectionFactory.java 2000/08/31 16:37:08 1.4
@@ -8,6 +8,8 @@
import java.io.PrintWriter;
import java.sql.*;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Properties;
import org.jboss.minerva.pools.*;
import org.jboss.minerva.jdbc.*;
@@ -19,7 +21,7 @@
* you're interested in creating transactional-aware connections, see
* XAConnectionFactory, which complies with the JDBC 2.0 standard extension.
* @see org.jboss.minerva.factories.XAConnectionFactory
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @author Aaron Mulder ([EMAIL PROTECTED])
*/
public class JDBCConnectionFactory extends PoolObjectFactory {
@@ -144,6 +146,19 @@
try {
con.rollback();
} catch(SQLException e) {}
+
+ // Removed all the cached PreparedStatements for this Connection
+ Iterator it =
((Map)PreparedStatementInPool.preparedStatementCache.clone()).keySet().iterator();
+ PreparedStatement ps;
+ while(it.hasNext()) {
+ PSCacheKey key = (PSCacheKey)it.next();
+ if(key.con.equals(con)) {
+ ps =
(PreparedStatement)PreparedStatementInPool.preparedStatementCache.remove(key);
+ if(ps != null) // Sanity check
+ try {ps.close();} catch(SQLException e) {}
+ }
+ }
+
try {
con.close();
} catch(SQLException e) {}