User: mulder  
  Date: 00/06/09 08:11:14

  Modified:    src/main/org/jboss/minerva/factories
                        XAConnectionFactory.java
  Log:
  Rollback JDBC1 connection wrapper after it was used without a current
  transaction.  Otherwise, it will keep any pending changes until the next
  time it's checked out of the pool.  When used with a transaction, the
  transaction will commit or rollback.
  
  Revision  Changes    Path
  1.3       +11 -2     
jboss/src/main/org/jboss/minerva/factories/XAConnectionFactory.java
  
  Index: XAConnectionFactory.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/factories/XAConnectionFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XAConnectionFactory.java  2000/06/03 02:20:46     1.2
  +++ XAConnectionFactory.java  2000/06/09 15:11:14     1.3
  @@ -22,7 +22,7 @@
    * and any work done isn't associated with the java.sql.Connection anyway.
    * <P><B>Note:</B> This implementation requires that the TransactionManager
    * be bound to a JNDI name.</P>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    * @author Aaron Mulder ([EMAIL PROTECTED])
    */
   public class XAConnectionFactory extends PoolObjectFactory {
  @@ -65,8 +65,17 @@
                       throw new RuntimeException("Unable to deregister with 
TransactionManager: "+e);
                   }
                   con.removeConnectionEventListener(listener);
  -                if(!transaction || !(con instanceof XAConnectionImpl))
  +
  +                if(!(con instanceof XAConnectionImpl)) {
  +                    // Real XAConnection -> not associated w/ transaction
                       pool.releaseObject(con);
  +                } else {
  +                    if(!transaction) {
  +                        // Wrapper - we can only release it if there's no current 
transaction
  +                        ((XAConnectionImpl)con).rollback();
  +                        pool.releaseObject(con);
  +                    }
  +                }
               }
           };
           transListener = new TransactionListener() {
  
  
  

Reply via email to