[jboss-svn-commits] JBL Code SVN: r25842 - in labs/jbosstm/trunk/ArjunaCore/arjuna: tests/classes/com/hp/mwtests/ts/arjuna/reaper and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Mar 26 14:23:05 EDT 2009


Author: mmusgrov
Date: 2009-03-26 14:23:05 -0400 (Thu, 26 Mar 2009)
New Revision: 25842

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/reaper/ReaperTestCase2.java
Log:
Add a check to force the reaper to ignore the transaction if it has already begun completion processing.
Update the reaper test case to reflect the new semantics.

JBTM-516


Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java	2009-03-26 15:31:41 UTC (rev 25841)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java	2009-03-26 18:23:05 UTC (rev 25842)
@@ -649,13 +649,8 @@
 				new Object[]{Thread.currentThread(),
 					     e._control.get_uid()});
 		    }
-
-		    synchronized(this)
-		    {
-		        removeElement(e);
-		    }
 		}
-		else
+		else if (e._control.running())
 		{
 		    if (exception != null)
 		    {
@@ -681,11 +676,6 @@
 			}
 		    }
 
-		    synchronized(this)
-		    {
-		        removeElement(e);
-		    }
-
 		    try
 		    {
 			if (e._control.preventCommit()) {
@@ -728,6 +718,12 @@
 			}
 		    }
 		}
+
+		synchronized(this)
+		{
+			removeElement(e);
+		}
+
 	    }
         }
 

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/reaper/ReaperTestCase2.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/reaper/ReaperTestCase2.java	2009-03-26 15:31:41 UTC (rev 25841)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/reaper/ReaperTestCase2.java	2009-03-26 18:23:05 UTC (rev 25842)
@@ -60,10 +60,10 @@
         // to cancel requests and ensure that they get cancelled
         // and that the reaper does not get wedged
 
-	SlowReapable reapable1 = new SlowReapable(new Uid(), 2000, 0, true, true);
-	SlowReapable reapable2 = new SlowReapable(new Uid(), 0, 0, true, true);
-	SlowReapable reapable3 = new SlowReapable(new Uid(), 100, 2000, false, true);
-	SlowReapable reapable4 = new SlowReapable(new Uid(), 1000, 1000, false, false);
+	SlowReapable reapable1 = new SlowReapable(new Uid(), 2000, 0, true, true, false);
+	SlowReapable reapable2 = new SlowReapable(new Uid(), 0, 0, true, true, false);
+	SlowReapable reapable3 = new SlowReapable(new Uid(), 100, 2000, false, true, false);
+	SlowReapable reapable4 = new SlowReapable(new Uid(), 1000, 1000, false, false, false);
 
 	// insert reapables so they timeout at 1 second intervals then
 	// check progress of cancellations and rollbacks
@@ -131,8 +131,10 @@
 	}
 
 	assertTrue(count < 10);
-	assertTrue(reapable1.getRollbackTried());
-	
+	// the first one should not be running because it marks itself ActionStatus.ABORTED
+	// - the reaper should not attempt to roll it back in this case
+	assertTrue(!reapable1.getRollbackTried());
+
 	// check that the third one refuses the cancel and gets marked
 	// for rollback instead
 
@@ -193,13 +195,14 @@
 
     public class SlowReapable implements Reapable
     {
-	public SlowReapable(Uid uid, int callDelay, int interruptDelay, boolean doCancel, boolean doRollback)
+	public SlowReapable(Uid uid, int callDelay, int interruptDelay, boolean doCancel, boolean doRollback, boolean doComplete)
 	{
 	    this.uid = uid;
             this.callDelay = callDelay;
             this.interruptDelay = interruptDelay;
             this.doCancel = doCancel;
             this.doRollback = doRollback;
+            this.doComplete = doComplete;
 	    cancelTried = false;
 	    rollbackTried = false;
 	    running = true;
@@ -260,6 +263,7 @@
         private int interruptDelay; // in milliseconds
         private boolean doCancel;
         private boolean doRollback;
+        private boolean doComplete;
 	private boolean cancelTried;
 	private boolean rollbackTried;
 	private boolean running;




More information about the jboss-svn-commits mailing list