User: mulder  
  Date: 00/10/25 16:54:37

  Modified:    src/main/org/jboss/minerva/factories
                        XAConnectionFactory.java
  Log:
  More compliant with JDBC 2 Optional Package spec.
   - Don't de-register a connection from transaction in case of error
   - Don't allow commit, rollback, or setAutoCommit(true) if registered
       with transaction
  
  Also try to avoid a sporadic problem in load test where it tries to
    deregister a connection from the transaction but it has no record
    of a resource for the connection.  I think this is a threading issue
    where somehow the event is triggered again before the listener is
    removed, though that's only a guess.  Unfortunately I've only seen
    the problem twice in about 50 5-minute runs, so it's pretty hard
    to test for.
  
  Revision  Changes    Path
  1.11      +8 -4      
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XAConnectionFactory.java  2000/10/21 05:20:22     1.10
  +++ XAConnectionFactory.java  2000/10/25 23:54:37     1.11
  @@ -39,7 +39,7 @@
    * connection, the same previous connection will be returned.  Otherwise,
    * you won't be able to share changes across connections like you can with
    * the native JDBC 2 Standard Extension implementations.</P>
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
    * @author Aaron Mulder ([EMAIL PROTECTED])
    */
   public class XAConnectionFactory extends PoolObjectFactory {
  @@ -78,7 +78,7 @@
                   if(pool.isInvalidateOnError()) {
                       pool.markObjectAsInvalid(evt.getSource());
                   }
  -                closeConnection(evt, XAResource.TMFAIL);
  +//                closeConnection(evt, XAResource.TMFAIL);
               }
   
               public void connectionClosed(ConnectionEvent evt) {
  @@ -87,11 +87,16 @@
   
               private void closeConnection(ConnectionEvent evt, int status) {
                   XAConnection con = (XAConnection)evt.getSource();
  +                try {
  +                    con.removeConnectionEventListener(listener);
  +                } catch(IllegalArgumentException e) {
  +                    return; // Removed twice somehow?
  +                }
                   Transaction trans = null;
                   try {
                       if(tm.getStatus() != Status.STATUS_NO_TRANSACTION) {
                           trans = tm.getTransaction();
  -                        XAResource res = 
(XAResource)rms.get(con);//con.getXAResource();
  +                        XAResource res = (XAResource)rms.get(con);
                           trans.delistResource(res, status);
                           rms.remove(con);
                       }
  @@ -99,7 +104,6 @@
                       Logger.exception(e);
                       throw new RuntimeException("Unable to deregister with 
TransactionManager: "+e);
                   }
  -                con.removeConnectionEventListener(listener);
   
                   if(!(con instanceof XAConnectionImpl)) {
                       // Real XAConnection -> not associated w/ transaction
  
  
  

Reply via email to