User: patriot1burke
  Date: 01/08/21 11:35:51

  Modified:    src/main/org/jboss/ejb/plugins/lock
                        QueuedPessimisticEJBLock.java
  Log:
  Needed to set tx after obtaining lock
  
  Revision  Changes    Path
  1.3       +12 -9     
jboss/src/main/org/jboss/ejb/plugins/lock/QueuedPessimisticEJBLock.java
  
  Index: QueuedPessimisticEJBLock.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/lock/QueuedPessimisticEJBLock.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QueuedPessimisticEJBLock.java     2001/08/08 22:13:00     1.2
  +++ QueuedPessimisticEJBLock.java     2001/08/21 18:35:51     1.3
  @@ -42,7 +42,7 @@
    * @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
    * @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
    *
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    *
    * <p><b>Revisions:</b><br>
    * <p><b>2001/08/03: billb</b>
  @@ -156,10 +156,10 @@
      protected boolean doSchedule(MethodInvocation mi) 
         throws Exception
      {
  -      this.sync();
         boolean wasThreadScheduled = false;
         Transaction miTx = mi.getTransaction();
         boolean trace = log.isTraceEnabled();
  +      this.sync();
         try
         {
            if( trace ) log.trace("Begin schedule, key="+mi.getId());
  @@ -249,9 +249,9 @@
         // We loop here until either until success or until transaction timeout
         // If we get out of the loop successfully, we can successfully
         // set the transaction on this puppy.
  -      while (tx != null &&
  +      while (this.tx != null &&
                // And are we trying to enter with another transaction?
  -             !tx.equals(miTx))
  +             !this.tx.equals(miTx))
         {
            wasScheduled = true;
            // That's no good, only one transaction per context
  @@ -260,7 +260,7 @@
            
            TxLock txLock = getTxLock(miTx);
            
  -         if( trace ) log.trace("Begin wait on Tx="+tx);
  +         if( trace ) log.trace("Begin wait on Tx="+this.tx);
            
            // And lock the threads on the lock corresponding to the Tx in MI
            synchronized(txLock)
  @@ -274,7 +274,7 @@
            
            this.sync();
            
  -         if( trace ) log.trace("End wait on TxLock="+tx);
  +         if( trace ) log.trace("End wait on TxLock="+this.tx);
            if (isTxExpired(miTx))
            {
               log.error(Thread.currentThread() + "Saw rolled back tx="+miTx+" waiting 
for txLock"
  @@ -289,7 +289,7 @@
                  txLocks.remove(txLock);
                  txWaitQueue.remove(txLock);
               }
  -            else if (tx != null && tx.equals(miTx))
  +            else if (this.tx != null && tx.equals(miTx))
               {
                  // We're not qu
                  nextTransaction();
  @@ -297,6 +297,9 @@
               throw new RuntimeException("Transaction marked for rollback, possibly a 
timeout");
            }
         } // end while(tx!=miTx)
  +
  +      // If we get here, this means that we have the txlock
  +      this.tx = miTx;
         return wasScheduled;
      }
   
  @@ -405,7 +408,7 @@
         if (numMethodLocks == 0)
         {
            synchronized(methodLock) {methodLock.notify();}
  -      }
  +      } 
      }
      
      /*
  @@ -438,7 +441,7 @@
            //         saveStackTrace("****removing bean lock and it has tx's in 
QUEUE!***");
            throw new IllegalStateException("removing bean lock and it has tx's in 
QUEUE!");
         }
  -      else if (refs == 0 && tx != null) 
  +      else if (refs == 0 && this.tx != null) 
         {
            //         saveStackTrace("****removing bean lock and it has tx set!***");
            throw new IllegalStateException("removing bean lock and it has tx set!");
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to