Patches item #494915, was opened at 2001-12-18 21:28
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=494915&group_id=22866

Category: JBossServer
Group: v2.4 BETA (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Larry Sanderson (lsanders)
Assigned to: Nobody/Anonymous (nobody)
Summary: disable PreparedStatement Cache

Initial Comment:
The org.jboss.pool.jdbc.xa.wrapper.XAClientConnection 
class provides a mechanism to pool prepared 
statements.  Currently, there is no way to disable the 
pooling, but there is a way to set the cache's maximum 
size.  A zero indicates no maximum.

I modified it so that if the PSCacheSize is set to 
zero, that will disable the pooling.  If set to any 
negetive number, then the cache size has no maximum.

diff -u:

=======================================================
============
RCS 
file: /cvsroot/jboss/jbosspool/src/main/org/jboss/pool/
jdbc/xa/wrapper/Attic/XAClientConnection.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 XAClientConnection.java
--- 
org/jboss/pool/jdbc/xa/wrapper/XAClientConnection.java 
     2001/05/15 07:58:24     1.1.1.1
+++ 
org/jboss/pool/jdbc/xa/wrapper/XAClientConnection.java 
     2001/12/19 05:21:22
@@ -71,7 +71,7 @@
      */
     public void setPSCacheSize(int maxSize) {
         preparedStatementCacheSize = maxSize;
-        if(maxSize >= 0 && preparedStatementCache != 
null) {
+        if(preparedStatementCache != null) {
             preparedStatementCache.setSize(maxSize);
         }
     }
@@ -164,7 +164,13 @@
     public PreparedStatement prepareStatement(String 
sql) throws SQLException {

         if(con == null) throw new SQLException
(CLOSED);
         try {
-            PreparedStatement ps = (PreparedStatement)
preparedStatementCache.useObject(sql);
+            PreparedStatement ps;
+            if (preparedStatementCacheSize == 0) {
+                // cache disabled
+                ps = con.prepareStatement(sql);
+            } else {
+                ps = (PreparedStatement)
preparedStatementCache.useObject(sql);
+            }
             if(ps == null)
                 throw new SQLException("Unable to 
create PreparedStatement!");
             PreparedStatementInPool wrapper = new 
PreparedStatementInPool(ps, this, sql);


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=494915&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to