[jboss-svn-commits] JBL Code SVN: r11815 - labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu May 10 13:18:11 EDT 2007
Author: mark.little at jboss.com
Date: 2007-05-10 13:18:11 -0400 (Thu, 10 May 2007)
New Revision: 11815
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread/ThreadActionData.java
Log:
Changed Vector use to ArrayList since it does not need to be synchronized on use. http://jira.jboss.com/jira/browse/JBTM-216
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread/ThreadActionData.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread/ThreadActionData.java 2007-05-10 16:42:53 UTC (rev 11814)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/thread/ThreadActionData.java 2007-05-10 17:18:11 UTC (rev 11815)
@@ -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