User: starksm
Date: 01/12/27 13:10:40
Modified: src/main/org/jboss/pool/jdbc/xa/wrapper Tag: Branch_2_4
XAClientConnection.java
Log:
Apply patch #494915 to support disabling PreparedStatement cache
Revision Changes Path
No revision
No revision
1.1.1.1.2.1 +11 -3
jbosspool/src/main/org/jboss/pool/jdbc/xa/wrapper/Attic/XAClientConnection.java
Index: XAClientConnection.java
===================================================================
RCS file:
/cvsroot/jboss/jbosspool/src/main/org/jboss/pool/jdbc/xa/wrapper/Attic/XAClientConnection.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- XAClientConnection.java 2001/05/15 07:58:24 1.1.1.1
+++ XAClientConnection.java 2001/12/27 21:10:40 1.1.1.1.2.1
@@ -71,7 +71,7 @@
*/
public void setPSCacheSize(int maxSize) {
preparedStatementCacheSize = maxSize;
- if(maxSize >= 0 && preparedStatementCache != null) {
+ if(preparedStatementCache != null) {
preparedStatementCache.setSize(maxSize);
}
}
@@ -127,7 +127,9 @@
*/
public void statementClosed(Statement st) {
statements.remove(st);
- if ((con != null) && (st instanceof PreparedStatementInPool)) {
+ if ((con != null) && (st instanceof PreparedStatementInPool) &&
+ preparedStatementCacheSize != 0) {
+
// Now return the "real" statement to the pool
PreparedStatementInPool ps = (PreparedStatementInPool) st;
PreparedStatement ups = ps.getUnderlyingPreparedStatement();
@@ -164,7 +166,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);
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development