User: oleg    
  Date: 00/11/09 05:47:53

  Modified:    src/main/org/jboss/minerva/xa XAClientConnection.java
  Log:
  If the underlying Connection is null, the PreparedStatement is not returned to the 
pool.
  This situation never happens, but in order to play safe...
  
  Revision  Changes    Path
  1.6       +7 -6      jboss/src/main/org/jboss/minerva/xa/XAClientConnection.java
  
  Index: XAClientConnection.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/xa/XAClientConnection.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XAClientConnection.java   2000/10/25 23:54:37     1.5
  +++ XAClientConnection.java   2000/11/09 13:47:52     1.6
  @@ -32,7 +32,7 @@
    * returned to the pool) until the transactional details are taken care of.
    * This instance only lives as long as one client is using it - though we
    * probably want to consider reusing it to save object allocations.
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    * @author Aaron Mulder ([EMAIL PROTECTED])
    */
   public class XAClientConnection implements ConnectionWrapper {
  @@ -98,20 +98,21 @@
        */
       public void statementClosed(Statement st) {
           statements.remove(st);
  -        if (st instanceof PreparedStatementInPool) {
  +        if ((con != null) && (st instanceof PreparedStatementInPool)) {
               // Now return the "real" statement to the pool
               PreparedStatementInPool ps = (PreparedStatementInPool) st;
  +            PreparedStatement ups = ps.getUnderlyingPreparedStatement();
               int rsType = ResultSet.TYPE_FORWARD_ONLY;
               int rsConcur = ResultSet.CONCUR_READ_ONLY;
  +
               // We may have JDBC 1.0 driver
               try {
  -                rsType = ps.getResultSetType();
  -                rsConcur = ps.getResultSetConcurrency();
  +                rsType = ups.getResultSetType();
  +                rsConcur = ups.getResultSetConcurrency();
               } catch (Throwable th) {
               }
               PreparedStatementInPool.preparedStatementCache.put(
  -                    new PSCacheKey(con, ps.getSql(), rsType, rsConcur),
  -                    ps.getUnderlyingPreparedStatement());
  +                    new PSCacheKey(con, ps.getSql(), rsType, rsConcur), ups);
           }
       }
   
  
  
  

Reply via email to