[jboss-svn-commits] JBL Code SVN: r29637 - in labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats: internal/arjuna/coordinator and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Oct 16 09:56:32 EDT 2009


Author: jhalliday
Date: 2009-10-16 09:56:32 -0400 (Fri, 16 Oct 2009)
New Revision: 29637

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/ReaperElementManager.java
Log:
reaper bug fix. JBTM-624


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-10-16 13:37:29 UTC (rev 29636)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TransactionReaper.java	2009-10-16 13:56:32 UTC (rev 29637)
@@ -928,13 +928,13 @@
         _timeouts.remove(reaperElement._control);
 
         synchronized (this) {
-            try {
-                ReaperElement first = _reaperElements.getFirst();
+
+            // TODO set needs tobe atomic to getFirst?
+            ReaperElement first = _reaperElements.getFirst();
+            if(first != null) {
                 nextDynamicCheckTime.set(first.getAbsoluteTimeout());
-                // TODO set needs tobe atomic to getFirst?
-            } catch(IndexOutOfBoundsException e) {
+            } else {
                 nextDynamicCheckTime.set(Long.MAX_VALUE);
-
                 if(_inShutdown) {
                     this.notifyAll(); // TODO: use different lock for shutdown?
                 }

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/ReaperElementManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/ReaperElementManager.java	2009-10-16 13:37:29 UTC (rev 29636)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/ReaperElementManager.java	2009-10-16 13:56:32 UTC (rev 29637)
@@ -62,7 +62,7 @@
 public class ReaperElementManager
 {
     /**
-     * @return the first (i.e. earliest to time out) element of the colleciton.
+     * @return the first (i.e. earliest to time out) element of the colleciton or null if empty
      */
     public synchronized ReaperElement getFirst() {
         flushPending(); // we need to order the elements before we can tell which is first.
@@ -73,7 +73,7 @@
         }
     }
 
-    // note - unsynchronized for performance.
+    // Note - unsynchronized for performance.
     public void add(ReaperElement reaperElement) throws IllegalStateException {
         if(pendingInsertions.putIfAbsent(reaperElement, reaperElement) != null) {
             // note this is best effort - we'll allow double inserts if the element is also in the ordered set.
@@ -83,7 +83,7 @@
 
     /**
      * @param reaperElement the reaper element to reorder in the sorted set.
-     * @param delayMillis the ammout of time to increment the element's timeout by.
+     * @param delayMillis the amount of time to increment the element's timeout by.
      * @return the new soonest timeout in the set (not necessarily that of the reordered element)
      */
     public synchronized long reorder(ReaperElement reaperElement, long delayMillis) {



More information about the jboss-svn-commits mailing list