[jboss-svn-commits] JBL Code SVN: r29438 - labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Sep 23 05:10:57 EDT 2009
Author: jhalliday
Date: 2009-09-23 05:10:57 -0400 (Wed, 23 Sep 2009)
New Revision: 29438
Modified:
labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread/ThreadActionData.java
Log:
Backported ThreadActionData performance improvement to 4.2.3.CP branch. JBTM-216
Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread/ThreadActionData.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread/ThreadActionData.java 2009-09-23 09:05:45 UTC (rev 29437)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread/ThreadActionData.java 2009-09-23 09:10:57 UTC (rev 29438)
@@ -35,8 +35,8 @@
import com.arjuna.ats.arjuna.utils.ThreadUtil;
import java.lang.Thread;
+import java.util.ArrayList;
import java.util.Stack;
-import java.util.Vector;
import java.util.NoSuchElementException;
import java.util.EmptyStackException;
@@ -258,21 +258,43 @@
}
}
+ /**
+ * Add a per thread setup object to the global list. This should only
+ * happen before the transaction service really begins, or you risk having
+ * some threads see one view of the list that is different to other threads.
+ *
+ * @param s the setup to add.
+ */
+
public static void addSetup (ThreadSetup s)
{
- _threadSetups.addElement(s);
+ synchronized (_threadSetups)
+ {
+ _threadSetups.add(s);
+ }
}
+ /**
+ * Remove a per thread setup object to the global list. This should only
+ * happen after the transaction service really ends, or you risk having
+ * some threads see one view of the list that is different to other threads.
+ *
+ * @param s the setup to add.
+ */
+
public static boolean removeSetup (ThreadSetup s)
{
- return _threadSetups.removeElement(s);
+ synchronized (_threadSetups)
+ {
+ return _threadSetups.remove(s);
+ }
}
private static void setup ()
{
for (int i = 0; i < _threadSetups.size(); i++)
{
- ThreadSetup s = (ThreadSetup) _threadSetups.elementAt(i);
+ ThreadSetup s = (ThreadSetup) _threadSetups.get(i);
if (s != null)
s.setup();
@@ -281,6 +303,6 @@
private static ThreadLocal _threadList = new ThreadLocal();
- private static Vector _threadSetups = new Vector();
+ private static ArrayList _threadSetups = new ArrayList();
}
More information about the jboss-svn-commits
mailing list