User: fleury  
  Date: 00/07/27 15:24:52

  Modified:    src/main/org/jboss/tm TransactionImpl.java TxManager.java
                        XidImpl.java
  Log:
  stop gap and some bug fixing.  At least the cache sees the right transaction with 
the right hashcode
  
  Revision  Changes    Path
  1.5       +2 -2      jboss/src/main/org/jboss/tm/TransactionImpl.java
  
  Index: TransactionImpl.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/tm/TransactionImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TransactionImpl.java      2000/07/25 02:20:25     1.4
  +++ TransactionImpl.java      2000/07/27 22:24:52     1.5
  @@ -29,7 +29,7 @@
    *
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.4 $
  + *   @version $Revision: 1.5 $
    */
   public class TransactionImpl
      implements Transaction, Serializable
  @@ -261,7 +261,7 @@
   
      public boolean equals(Object obj)
      {
  -      return 
((TransactionImpl)obj).xid.getGlobalTransactionId().equals(xid.getGlobalTransactionId());
  +       return ((TransactionImpl)obj).xid.equals(xid);
      }
   
      public int hashCode()
  
  
  
  1.4       +31 -10    jboss/src/main/org/jboss/tm/TxManager.java
  
  Index: TxManager.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/tm/TxManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TxManager.java    2000/07/25 02:20:25     1.3
  +++ TxManager.java    2000/07/27 22:24:52     1.4
  @@ -1,4 +1,4 @@
  -/*
  + /*
    * jBoss, the OpenSource EJB server
    *
    * Distributable under GPL license.
  @@ -23,7 +23,7 @@
    *      
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.3 $
  + *   @version $Revision: 1.4 $
    */
   public class TxManager
      implements TransactionManager
  @@ -77,18 +77,24 @@
         
   //DEBUG      Logger.debug("Current="+current);
         
  -      if (current == null)
  -         return noTx;
  -      else
  +    //  if (current == null)
  +
  +         // MF FIXME 
  +              // WHY?????
  +     //       return noTx;
  +    //  else
            return current;
      }
   
  +   // FIXME MF: resume has another meaning
  +   // it means "resume the suspended transaction"
  +   // Not resume the association with thread 
      public void resume(Transaction tobj)
               throws InvalidTransactionException,
                      java.lang.IllegalStateException,
                      SystemException
      {
  -//DEBUG      Logger.debug("resume tx");
  +//      Logger.debug("resume tx with "+tobj);
         tx.set(tobj);
      }
                      
  @@ -126,15 +132,30 @@
         return current;
      }
      
  +   /*
  +   * The following 2 methods are here to provide association and disassociation of 
the thread
  +   */
  +   public Transaction disassociateThread() {
  +     
  +             Transaction current = (Transaction) tx.get();
  +     
  +             tx.set(null);
  +
  +             return current;
  +   }
  +   
  +   public void associateThread(Transaction transaction) {
  +     
  +        tx.set(transaction);
  +   }
  +   
  +   
      // Package protected ---------------------------------------------
      void removeTransaction()
      {
         tx.set(null);
      }
  -   void associateTransaction(Transaction transaction) {
  -     
  -        tx.set(transaction);
  -   }
  +   
      
      // There has got to be something better :)
      static TxManager getTransactionManager() {
  
  
  
  1.3       +18 -1     jboss/src/main/org/jboss/tm/XidImpl.java
  
  Index: XidImpl.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/tm/XidImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XidImpl.java      2000/06/21 11:51:36     1.2
  +++ XidImpl.java      2000/07/27 22:24:52     1.3
  @@ -13,7 +13,7 @@
    *      
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.2 $
  + *   @version $Revision: 1.3 $
    */
   public class XidImpl
      implements Xid, java.io.Serializable
  @@ -51,6 +51,23 @@
         return branchId;
      }
      
  +   /*
  +   * equals works on all the bytes of the Xid
  +   */
  +   public boolean equals(Object obj) {
  +        
  +      byte[] otherGlobalId = ((XidImpl) obj).globalId;
  +     
  +      for (int i = 0 ; i<globalId.length ; i++) {
  +             
  +              if (otherGlobalId[i] != globalId[i]) {
  +                     
  +                       return false;
  +              }
  +      }      
  +     
  +      return true;
  +   }
      // Package protected ---------------------------------------------
       
      // Protected -----------------------------------------------------
  
  
  

Reply via email to