[jboss-svn-commits] JBL Code SVN: r26589 - in labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts: interposition/resources/osi and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon May 18 10:05:03 EDT 2009


Author: jhalliday
Date: 2009-05-18 10:05:03 -0400 (Mon, 18 May 2009)
New Revision: 26589

Removed:
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/InterposedHierarchy.java
Modified:
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/Interposition.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/ServerResource.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/osi/OSIInterposition.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/restricted/RestrictedInterposition.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/strict/StrictInterposition.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedNestedAction.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedTopLevelAction.java
Log:
Remove use of HashList in interposition code. JBTM-557


Deleted: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/InterposedHierarchy.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/InterposedHierarchy.java	2009-05-18 13:31:23 UTC (rev 26588)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/InterposedHierarchy.java	2009-05-18 14:05:03 UTC (rev 26589)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
- * of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- * 
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 1998, 1999, 2000,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.  
- *
- * $Id: InterposedHierarchy.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.jts.interposition.resources.arjuna;
-
-import org.omg.CosTransactions.*;
-
-import com.arjuna.ats.arjuna.common.Uid;
-
-import com.arjuna.ats.internal.arjuna.template.*;
-
-import com.arjuna.ats.jts.*;
-
-import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.*;
-
-import java.io.PrintWriter;
-
-public class InterposedHierarchy implements ListElement
-{
-    
-    public InterposedHierarchy (ServerTopLevelAction action)
-    {
-	_action = action;
-    }
-
-    public final ServerTopLevelAction action ()
-    {
-	return _action;
-    }
-
-    public Uid get_uid ()
-    {
-	return ((_action != null) ? _action.get_uid() : Uid.nullUid());
-    }
-    
-    public final String hierarchy ()
-    {
-	String hier = "InterposedHierarchy:";
-
-	if (_action != null)
-	{
-	    hier += _action.get_uid();
-
-	    HashList children = _action.getChildren();
-
-	    if (children != null)
-	    {
-		HashListIterator iter = new HashListIterator(children);
-		ServerNestedAction childPtr = (ServerNestedAction) iter.iterate();
-
-		while (childPtr != null)
-		{
-		    hier += "\n"+childPtr.get_uid();
-
-		    hier += childPtr.getChildren(2);
-		    childPtr = (ServerNestedAction) iter.iterate();
-		}
-
-		iter = null;
-	    }
-	}
-	else
-	    hier += "EMPTY";
-
-	return hier;
-    }
-
-    private ServerTopLevelAction _action;
-
-}

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/Interposition.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/Interposition.java	2009-05-18 13:31:23 UTC (rev 26588)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/Interposition.java	2009-05-18 14:05:03 UTC (rev 26589)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -24,7 +24,7 @@
  * Arjuna Solutions Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
- * UK.  
+ * UK.
  *
  * $Id: Interposition.java 2342 2006-03-30 13:06:17Z  $
  */
@@ -55,12 +55,15 @@
 import org.omg.CORBA.UNKNOWN;
 import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
 
+import java.util.List;
+import java.util.LinkedList;
+
 public class Interposition
 {
 
-public Interposition ()
+    public Interposition ()
     {
-	_head = new HashList(11);
+        _head = new LinkedList(); // not synchronized as the methods that access it all are synchronized.
     }
 
 public static ControlImple create (PropagationContext context) throws SystemException
@@ -78,7 +81,7 @@
 	else
 	    return false;
     }
-    
+
     /*
      * Assume that all actions in the imported hierarchy are of the same
      * type, i.e., all JBoss transactions.
@@ -91,7 +94,7 @@
     {
 	ControlImple controlPtr = null;
 	Uid theUid = null;
-	InterposedHierarchy proxyAction = null;
+	ServerTopLevelAction proxyAction = null;
 
 	if (context.parents.length == 0)
 	    theUid = Utility.otidToUid(context.current.otid);
@@ -122,9 +125,19 @@
 	return controlPtr;
     }
 
-protected final synchronized InterposedHierarchy present (Uid actUid)
+    protected final synchronized ServerTopLevelAction present (Uid actUid)
     {
-	return (InterposedHierarchy) _head.lookFor(actUid);
+        if(_head == null) {
+            return null;
+        }
+
+        for(ServerTopLevelAction action : _head) {
+            if(actUid.equals(action.get_uid())) {
+                return action;
+            }
+        }
+
+        return null;
     }
 
 protected synchronized ControlImple createHierarchy (PropagationContext ctx, Uid tlUid) throws SystemException
@@ -141,7 +154,7 @@
 	ServerResource action = null;
 	Coordinator tmpCoord = null;
 	Terminator tmpTerm = null;
-	
+
 	/*
 	 * First deal with top-level transaction, which may be
 	 * the current transaction.
@@ -180,9 +193,9 @@
 
 	    throw new TRANSACTION_ROLLEDBACK();
 	}
-		
-	InterposedHierarchy newElement = new InterposedHierarchy((ServerTopLevelAction) action);
 
+	ServerTopLevelAction newElement = (ServerTopLevelAction)action;
+
 	_head.add(newElement);
 
 	if (depth > 0) // current is a nested transaction
@@ -193,12 +206,12 @@
 	     */
 
 	    ServerResource nestedAction = null;
-    
+
 	    for (int i = depth -2; i >= 0; i--)
 	    {
 		tmpCoord = ctx.parents[i].coord;
 		tmpTerm = ctx.parents[i].term;
-	
+
 		control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.parents[i].otid),
 								  tmpCoord, tmpTerm, control);
 
@@ -211,7 +224,7 @@
 		     * registered successfully, and will be deal with automatically
 		     * when the parent transaction terminates.
 		     */
-		
+
 		    try
 		    {
 			((ServerNestedAction) nestedAction).rollback_subtransaction();  // does dispose as well!
@@ -223,7 +236,7 @@
 
 		    throw new TRANSACTION_ROLLEDBACK();
 		}
-		
+
 		/*
 		 * Add transaction resource to list.
 		 */
@@ -239,10 +252,10 @@
 
 	    tmpCoord = ctx.current.coord;
 	    tmpTerm = ctx.current.term;
-	    
+
 	    control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.current.otid),
 							      tmpCoord, tmpTerm, control);
-	    
+
 	    nestedAction = new ServerNestedAction(control);
 
 	    if (!nestedAction.valid())
@@ -252,7 +265,7 @@
 		 * registered successfully, and will be deal with automatically
 		 * when the parent transaction terminates.
 		 */
-		
+
 		try
 		{
 		    ((ServerNestedAction) nestedAction).rollback_subtransaction();  // does dispose as well!
@@ -264,7 +277,7 @@
 
 		throw new TRANSACTION_ROLLEDBACK();
 	    }
- 
+
 	    action.addChild((ServerNestedAction) nestedAction);
 	}
 
@@ -273,7 +286,7 @@
 
 	return control;
     }
-    
+
     /*
      * In a single threaded environment we could walk down the hierarchy,
      * aborting any actions which are no longer valid, and creating any new
@@ -287,15 +300,15 @@
      * current representation, we begin to assemble a new subtree in much the
      * same way as we did for creating a completely new hierarchy.
      */
-    
-protected synchronized ControlImple checkHierarchy (InterposedHierarchy hier,
+
+protected synchronized ControlImple checkHierarchy (ServerTopLevelAction hier,
 						   PropagationContext context) throws SystemException
     {
 	ServerControl control = null;
-	ServerResource currentAction = hier.action();  // top-level transaction
+	ServerResource currentAction = hier;  // top-level transaction
 	int depth = context.parents.length;
 	int differenceIndex = -1;  // index of the new transactions in the hierarchy
-	
+
 	/*
 	 * Find the point at which our notion of the hierarchy deviates from
 	 * the one we have just received.
@@ -315,12 +328,12 @@
 	     * the control to return.
 	     */
 
-	    control = hier.action().control();  // top-level transaction's control
+	    control = hier.control();  // top-level transaction's control
 	}
 	else
 	{
 	    ServerResource nestedAction = null;
-	    
+
 	    /*
 	     * Start at -2 and work our way down the hierarchy. We
 	     * use -2 since the length gives us the *number* of elements,
@@ -343,7 +356,7 @@
 		     * currentAction *always* points to the last known
 		     * good transaction in our hierarchy.
 		     */
-		
+
 		    currentAction = nestedAction;
 		}
 	    }
@@ -359,12 +372,12 @@
 
 		Coordinator tmpCoord;
 		Terminator tmpTerm;
-		
+
 		for (int j = differenceIndex; j >= 0; j--)
 		{
 		    tmpCoord = context.parents[j].coord;
 		    tmpTerm = context.parents[j].term;
-		    
+
 		    control = ServerFactory.create_subtransaction(Utility.otidToUid(context.parents[j].otid),
 								      tmpCoord, tmpTerm, control);
 		    nestedAction = new ServerNestedAction(control);
@@ -376,7 +389,7 @@
 			 * registered successfully, and will be deal with automatically
 			 * when the parent transaction terminates.
 			 */
-		
+
 			try
 			{
 			    ((ServerNestedAction) nestedAction).rollback();  // does dispose as well!
@@ -411,7 +424,7 @@
 	     */
 
 	    nestedAction = currentAction.getChild(currentUid);
-	    
+
 	    if (nestedAction == null)
 	    {
 		/*
@@ -420,11 +433,11 @@
 		 */
 
 		control = currentAction.control();
-		
+
 		/*
 		 * Now deal with the current transaction.
 		 */
-	    
+
 		TransIdentity currentID = context.current;
 
 		control = ServerFactory.create_subtransaction(currentUid,
@@ -438,7 +451,7 @@
 		     * been registered successfully, and will be deal with
 		     * automatically when the parent transaction terminates.
 		     */
-		
+
 		    try
 		    {
 			((ServerNestedAction) nestedAction).rollback();  // does dispose as well!
@@ -450,7 +463,7 @@
 
 		    throw new TRANSACTION_ROLLEDBACK();
 		}
-		
+
 		currentAction.addChild((ServerNestedAction) nestedAction);
 	    }
 	    else
@@ -473,29 +486,28 @@
      * @message com.arjuna.ats.internal.jts.interposition.resources.arjuna.ipfail {0} - could not find {1} to remove.
      */
 
-protected final synchronized boolean removeHierarchy (Uid action)
+    protected final synchronized boolean removeHierarchy (Uid theUid)
     {
-	InterposedHierarchy hier = ((_head != null) ? (InterposedHierarchy) _head.remove(action) : null);
+        ServerTopLevelAction action = present(theUid);
 
-	if (hier != null)
-	{
-	    hier = null;
+        if (action != null)
+        {
+            _head.remove(action);
+            return true;
+        }
+        else
+        {
+            if (jtsLogger.logger.isDebugEnabled())
+            {
+                if (jtsLogger.loggerI18N.isWarnEnabled())
+                {
+                    jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.interposition.resources.arjuna.ipfail",
+                            new Object[] {"Interposition.removeHeirarchy", theUid} );
+                }
+            }
+        }
 
-	    return true;
-	}
-	else
-	{
-	    if (jtsLogger.logger.isDebugEnabled())
-	    {
-		if (jtsLogger.loggerI18N.isWarnEnabled())
-		{
-		    jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.interposition.resources.arjuna.ipfail",
-					      new Object[] {"Interposition.removeHeirarchy", action} );
-		}
-	    }
-	}
-    
-	return false;
+        return false;
     }
 
     /**
@@ -504,12 +516,12 @@
      * @message com.arjuna.ats.internal.jts.interposition.resources.arjuna.ipnull Interposed hierarchy is null!
      */
 
-protected final void compareHierarchies (PropagationContext ctx, InterposedHierarchy ih)
+protected final void compareHierarchies (PropagationContext ctx, ServerTopLevelAction action)
     {
 	int depth = ctx.parents.length;
 	Uid[] ctxHierarchy = new Uid [depth+1];
 	boolean printHierarchies = false;
-    
+
 	for (int i = depth -1; i >= 0; i--)
 	{
 	    ctxHierarchy[i+1] = new Uid(Utility.otidToUid(ctx.parents[i].otid));
@@ -517,7 +529,6 @@
 
 	ctxHierarchy[0] = new Uid(Utility.otidToUid(ctx.current.otid));
 
-	ServerTopLevelAction action = ih.action();
 	boolean problem = false;
 
 	if (action != null)
@@ -559,7 +570,7 @@
 		    else
 			problem = true;
 		}
-		
+
 		if (problem)
 		{
 		    if (jtsLogger.loggerI18N.isWarnEnabled())
@@ -567,7 +578,7 @@
 			jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.interposition.resources.arjuna.ipnt");
 		    }
 
-		    printHierarchies = true;		    
+		    printHierarchies = true;
 		}
 	    }
 	}
@@ -583,7 +594,7 @@
 
 	if (!printHierarchies)
 	    printHierarchies = jtsLogger.logger.isDebugEnabled();
-	
+
 	if (printHierarchies)
 	{
 	    synchronized (jtsLogger.logger)
@@ -595,11 +606,11 @@
 			jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
 					       com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, Utility.getHierarchy(ctx));
 		    }
-		    
+
 		    if (jtsLogger.logger.isDebugEnabled())
 		    {
 			jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
-					       com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, ih.hierarchy());
+					       com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, hierarchytoString(action));
 		    }
 		}
 		else
@@ -611,7 +622,7 @@
 
 		    if (jtsLogger.logger.isWarnEnabled())
 		    {
-			jtsLogger.logger.warn(ih.hierarchy());
+			jtsLogger.logger.warn(hierarchytoString(action));
 		    }
 		}
 	    }
@@ -629,8 +640,31 @@
 	}
     }
 
-protected HashList _head;
+    private final String hierarchytoString(ServerTopLevelAction action)
+    {
+        String hier = "InterposedHierarchy:";
 
+        if (action != null)
+        {
+            hier += action.get_uid();
+
+            List<ServerNestedAction> children = action.getChildren();
+
+            synchronized (children) {
+                for(ServerNestedAction child : children) {
+                    hier += "\n"+child.get_uid();
+                    hier += child.getChildren(2);
+                }
+            }
+        }
+        else
+            hier += "EMPTY";
+
+        return hier;
+    }
+
+protected List<ServerTopLevelAction> _head;
+
 private static Interposition __list = new Interposition();
 
 }

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/ServerResource.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/ServerResource.java	2009-05-18 13:31:23 UTC (rev 26588)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/arjuna/ServerResource.java	2009-05-18 14:05:03 UTC (rev 26589)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -24,7 +24,7 @@
  * Arjuna Solutions Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
- * UK.  
+ * UK.
  *
  * $Id: ServerResource.java 2342 2006-03-30 13:06:17Z  $
  */
@@ -46,6 +46,7 @@
 
 import org.omg.CosTransactions.*;
 import java.io.PrintWriter;
+import java.util.*;
 
 import org.omg.CORBA.SystemException;
 
@@ -108,44 +109,39 @@
      * transaction's notion of its parent to us.
      */
 
-public final boolean addChild (ServerNestedAction c)
+    public final boolean addChild (ServerNestedAction c)
     {
-	if (_children != null)
-	{
-	    if (_children.add(c))
-	    {
-		c.setParentHandle(this);
-	    
-		return true;
-	    }
-	}
-    
-	return false;
+        if (_children.add(c))
+        {
+            c.setParentHandle(this);
+            return true;
+        }
+
+        return false;
     }
 
-public final boolean removeChild (ServerNestedAction c)
+    public final boolean removeChild (ServerNestedAction c)
     {
-	if (_children != null)
-	{
-	    c.setParentHandle(null);
-	    
-	    return _children.remove(c);
-	}
-	else
-	    return false;
+            c.setParentHandle(null);
+            return _children.remove(c);
     }
 
-public final ServerNestedAction getChild (Uid id)
+    public final ServerNestedAction getChild (Uid actUid)
     {
-	if (_children != null)
-	    return (ServerNestedAction) _children.lookFor(id);
-	else
-	    return null;
+        synchronized (_children) {
+            for(ServerNestedAction action : _children) {
+                if(actUid.equals(action.get_uid())) {
+                    return action;
+                }
+            }
+        }
+
+        return null;
     }
 
-public final HashList getChildren ()
+    public final List<ServerNestedAction> getChildren ()
     {
-	return _children;
+        return _children;
     }
 
     /**
@@ -155,10 +151,16 @@
 
 public final boolean abortChild (ServerNestedAction toAbort)
     {
-	if ((_children != null) && (toAbort != null))
+	if (toAbort != null)
 	{
-	    ServerNestedAction child = (ServerNestedAction) _children.remove(toAbort.get_uid());
-	
+        ServerNestedAction child;
+        synchronized (_children) {
+            child = getChild(toAbort.get_uid());
+            if(child != null) {
+                _children.remove(child);
+            }
+        }
+
 	    if (child != null)
 	    {
 		org.omg.CosTransactions.Status nestedStatus = child.otsStatus();
@@ -231,30 +233,24 @@
 	}
     }
 
-public final String getChildren (int depth)
+    public final String getChildren (int depth)
     {
-	String children = "";
-	
-	if (_children != null)
-	{
-	    HashListIterator iter = new HashListIterator(_children);
-	    ServerNestedAction childPtr = (ServerNestedAction) iter.iterate();
+        String children = "";
 
-	    while (childPtr != null)
-	    {
-		children += "\n";
-	    
-		for (int i = 0; i < depth; i++)
-		    children += " ";
+        synchronized (_children) {
+            for(ServerNestedAction child : _children) {
 
-		children += childPtr.get_uid();
+                children += "\n";
 
-		children += childPtr.getChildren(depth+1);
-		childPtr = (ServerNestedAction) iter.iterate();
-	    }
-	}
+                for (int i = 0; i < depth; i++)
+                    children += " ";
 
-	return children;
+                children += child.get_uid();
+                children += child.getChildren(depth+1);
+            }
+        }
+
+        return children;
     }
 
 protected ServerResource ()
@@ -266,7 +262,6 @@
 	}
 
 	_theControl = null;
-	_children = null;
 	_parent = null;
 	_valid = true;
 	_destroyed = false;
@@ -275,7 +270,6 @@
 protected ServerResource (ServerControl control)
     {
 	_theControl = control;
-	_children = new HashList(11);
 	_theUid = control.get_uid();
 	_parent = null;
 	_valid = true;
@@ -288,60 +282,52 @@
 	}
     }
 
-protected void tidyup ()
+    protected void tidyup ()
     {
-	if (_children != null)
-	{
-	    ServerNestedAction ptr = (ServerNestedAction) _children.orderedPop();
+        synchronized (_children) {
+            while(_children.size() > 0) {
+                ServerNestedAction child = _children.remove(0);
+                child.setParentHandle(null);
+                try
+                {
+                    ORBManager.getPOA().shutdownObject(child.theResource());
+                }
+                catch (Exception e)
+                {
+                }
+            }
+        }
 
-	    while (ptr != null)
-	    {
-		ptr.setParentHandle(null);
-		
-		try
-		{
-		    ORBManager.getPOA().shutdownObject(ptr.theResource());
-		}
-		catch (Exception e)
-		{
-		}
+        if (_theControl != null)
+        {
+            /*
+            * If it's a wrapper, then the control
+            * will not have been driven to commit or
+            * rollback or forget, and hence will not have destroyed
+            * itself. So, do so now.
+            */
 
-		ptr = (ServerNestedAction) _children.orderedPop();
-	    }
+            if (_theControl.isWrapper())
+            {
+                try
+                {
+                    _theControl.destroy();  // will delete itself
+                }
+                catch (Exception e)
+                {
+                }
+            }
 
-	    _children = null;
-	}
-
-	if (_theControl != null)
-	{
-	    /*
-	     * If it's a wrapper, then the control
-	     * will not have been driven to commit or
-	     * rollback or forget, and hence will not have destroyed
-	     * itself. So, do so now.
-	     */
-
-	    if (_theControl.isWrapper())
-	    {
-		try
-		{
-		    _theControl.destroy();  // will delete itself
-		}
-		catch (Exception e)
-		{
-		}
-	    }
-
-	    _theControl = null;
-	}
+            _theControl = null;
+        }
     }
 
 protected ServerControl  _theControl;
-protected HashList       _children;
+protected final List<ServerNestedAction> _children = Collections.synchronizedList(new LinkedList<ServerNestedAction>());
 protected Uid            _theUid;
 protected ServerResource _parent;
 protected boolean        _valid;
 protected boolean        _destroyed;
-    
+
 }
 

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/osi/OSIInterposition.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/osi/OSIInterposition.java	2009-05-18 13:31:23 UTC (rev 26588)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/osi/OSIInterposition.java	2009-05-18 14:05:03 UTC (rev 26589)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -24,7 +24,7 @@
  * Arjuna Solutions Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
- * UK.  
+ * UK.
  *
  * $Id: OSIInterposition.java 2342 2006-03-30 13:06:17Z  $
  */
@@ -74,11 +74,11 @@
 	/*
 	 * Map otid to a Uid.
 	 */
-    
+
 	Uid theUid = OTIDMap.find(context.current.otid);
-	InterposedHierarchy proxyAction = present(theUid);
+	ServerTopLevelAction proxyAction = present(theUid);
 	ControlImple controlPtr = null;
-	
+
 	if (proxyAction == null)
 	{
 	    /*
@@ -98,7 +98,7 @@
 protected OSIInterposition ()
     {
     }
-    
+
 protected synchronized ControlImple createHierarchy (PropagationContext ctx,
 						    Uid currentUid) throws SystemException
     {
@@ -120,7 +120,7 @@
 	ServerResource action = null;
 	Coordinator tmpCoord = null;
 	Terminator tmpTerm = null;
-	
+
 	/*
 	 * First deal with top-level transaction, which may be
 	 * the current transaction.
@@ -141,7 +141,7 @@
 	{
 	    return null;
 	}
-    
+
 	ServerControl control = ServerFactory.create_transaction(currentUid, null,
 									 null, tmpCoord, tmpTerm,
 								       ctx.timeout);
@@ -161,9 +161,9 @@
 
 	    throw new TRANSACTION_ROLLEDBACK();
 	}
-	
-	InterposedHierarchy newElement = new InterposedHierarchy((ServerOSITopLevelAction) action);
-    
+
+	ServerTopLevelAction newElement = (ServerOSITopLevelAction)action;
+
 	_head.add(newElement);
 
 	if (depth > 0)  // current is a nested transaction
@@ -174,7 +174,7 @@
 	     */
 
 	    ServerResource nestedAction = null;
-	
+
 	    for (int i = depth -2; i >= 0; i--)
 	    {
 		tmpCoord = ctx.parents[i].coord;
@@ -182,7 +182,7 @@
 
 		control = ServerFactory.create_subtransaction(OTIDMap.find(ctx.parents[i].otid),
 								  tmpCoord, tmpTerm, control);
-	    
+
 		nestedAction = new ServerOSINestedAction(control, false);  // not current, so don't register
 
 		if (!nestedAction.valid())
@@ -192,7 +192,7 @@
 		     * registered successfully, and will be deal with automatically
 		     * when the parent transaction terminates.
 		     */
-		
+
 		    try
 		    {
 			((ServerOSINestedAction) nestedAction).rollback_subtransaction();  // does dispose as well!
@@ -201,7 +201,7 @@
 		    catch (Exception e)
 		    {
 		    }
-		
+
 		    throw new TRANSACTION_ROLLEDBACK();
 		}
 
@@ -223,7 +223,7 @@
 
 	    control = ServerFactory.create_subtransaction(OTIDMap.find(ctx.current.otid),
 							      tmpCoord, tmpTerm, control);
-	
+
 	    nestedAction = new ServerOSINestedAction(control, true);  // current, so register
 
 	    if (!nestedAction.valid())
@@ -233,7 +233,7 @@
 		 * registered successfully, and will be deal with automatically
 		 * when the parent transaction terminates.
 		 */
-		
+
 		try
 		{
 		    ((ServerOSINestedAction) nestedAction).rollback_subtransaction();  // does dispose as well!
@@ -242,10 +242,10 @@
 		catch (Exception e)
 		{
 		}
-	    
+
 		throw new TRANSACTION_ROLLEDBACK();
 	    }
-	
+
 	    action.addChild((ServerOSINestedAction) nestedAction);
 	}
 
@@ -292,11 +292,11 @@
      * the right hierarchy gets sent out!
      */
 
-protected synchronized ControlImple checkHierarchy (InterposedHierarchy hier,
+protected synchronized ControlImple checkHierarchy (ServerTopLevelAction hier,
 						   PropagationContext context)
     {
 	ServerControl control = null;
-	ServerResource currentAction = hier.action();  // top-level transaction
+	ServerResource currentAction = hier;  // top-level transaction
 	int depth = context.parents.length;
 	int differenceIndex = -1;  // index of the new transactions in the hierarchy
 
@@ -319,17 +319,17 @@
 	     * the control to return. However, make sure it has registered
 	     * itself with the "real" transaction.
 	     */
-	    
-	    ServerOSITopLevelAction tx = (ServerOSITopLevelAction) hier.action();
 
+	    ServerOSITopLevelAction tx = (ServerOSITopLevelAction) hier;
+
 	    tx.interposeResource();
-	
+
 	    control = tx.control();  // top-level transaction's control
 	}
 	else
 	{
 	    ServerResource nestedAction = null;
-	
+
 	    /*
 	     * Start at -2 and work our way down the hierarchy. We
 	     * use -2 since the length gives us the *number* of elements,
@@ -352,7 +352,7 @@
 		     * currentAction *always* points to the last known
 		     * good transaction in our hierarchy.
 		     */
-		
+
 		    currentAction = nestedAction;
 		}
 	    }
@@ -365,10 +365,10 @@
 	    if (differenceIndex != -1)
 	    {
 		control = currentAction.control();
-		
+
 		Coordinator tmpCoord = null;
 		Terminator tmpTerm = null;
-		
+
 		for (int j = differenceIndex; j >= 0; j--)
 		{
 		    tmpCoord = context.parents[j].coord;
@@ -376,7 +376,7 @@
 
 		    control = ServerFactory.create_subtransaction(OTIDMap.find(context.parents[j].otid),
 								      tmpCoord, tmpTerm, control);
-		
+
 		    nestedAction = new ServerOSINestedAction(control, false);
 
 		    if (!nestedAction.valid())
@@ -386,7 +386,7 @@
 			 * registered successfully, and will be deal with automatically
 			 * when the parent transaction terminates.
 			 */
-		
+
 			try
 			{
 			    ((ServerOSINestedAction) nestedAction).rollback();  // does dispose as well!
@@ -410,7 +410,7 @@
 		 * Remember to check!
 		 */
 	    }
-	
+
 	    Uid currentUid = OTIDMap.find(context.current.otid);
 
 	    /*
@@ -419,18 +419,18 @@
 	     * structure. So, ask it if the sent hierarchy's child is
 	     * one of its children.
 	     */
-	    
+
 	    nestedAction = currentAction.getChild(currentUid);
-	
+
 	    if (nestedAction == null)
 	    {
 		/*
 		 * Different notion of current in sent hierarchy.
 		 * So, add it to the hierarchy here.
 		 */
-	    
+
 		control = currentAction.control();
-		
+
 		/*
 		 * Now deal with the current transaction.
 		 */
@@ -438,7 +438,7 @@
 		TransIdentity currentID = context.current;
 
 		control = ServerFactory.create_subtransaction(currentUid, currentID.coord, currentID.term, control);
-	    
+
 		nestedAction = new ServerOSINestedAction(control, true);
 
 		if (!nestedAction.valid())
@@ -460,7 +460,7 @@
 
 		    throw new TRANSACTION_ROLLEDBACK();
 		}
-		
+
 		currentAction.addChild((ServerOSINestedAction) nestedAction);
 	    }
 	    else
@@ -472,17 +472,17 @@
 		 */
 
 		nestedAction.interposeResource();
-	    
+
 		control = nestedAction.control();
 	    }
 	}
-	
+
 	if (jtsLogger.logger.isDebugEnabled())
 	    compareHierarchies(context, hier);
 
 	return control;
     }
-    
+
 private static OSIInterposition __list = new OSIInterposition();
- 
+
 }

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/restricted/RestrictedInterposition.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/restricted/RestrictedInterposition.java	2009-05-18 13:31:23 UTC (rev 26588)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/restricted/RestrictedInterposition.java	2009-05-18 14:05:03 UTC (rev 26589)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -24,7 +24,7 @@
  * Arjuna Solutions Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
- * UK.  
+ * UK.
  *
  * $Id: RestrictedInterposition.java 2342 2006-03-30 13:06:17Z  $
  */
@@ -64,7 +64,7 @@
 	else
 	    return null;
     }
-    
+
     /*
      * Assume that all actions in the imported hierarchy are of the same
      * type, i.e., all JBoss transactions.
@@ -77,7 +77,7 @@
     {
 	ControlImple controlPtr = null;
 	Uid theUid = null;
-	InterposedHierarchy proxyAction = null;
+	ServerTopLevelAction proxyAction = null;
 
 	if (context.parents.length == 0)
 	    theUid = Utility.otidToUid(context.current.otid);
@@ -104,7 +104,7 @@
 	    controlPtr = checkHierarchy(proxyAction, context);
 	}
 
-	return controlPtr;	    
+	return controlPtr;
     }
 
 protected synchronized ControlImple createHierarchy (PropagationContext ctx, Uid tlUid) throws SystemException
@@ -121,7 +121,7 @@
 	ServerTopLevelAction tlAction = null;
 	Coordinator tmpCoord = null;
 	Terminator tmpTerm = null;
-	
+
 	/*
 	 * First deal with top-level transaction, which may be
 	 * the current transaction.
@@ -150,7 +150,7 @@
 	     * registered successfully, and will be deal with automatically
 	     * when the parent transaction terminates.
 	     */
-		
+
 	    try
 	    {
 		tlAction.rollback();
@@ -162,9 +162,9 @@
 
 	    throw new TRANSACTION_ROLLEDBACK();
 	}
-	
-	InterposedHierarchy newElement = new InterposedHierarchy(tlAction);
 
+	ServerTopLevelAction newElement = tlAction;
+
 	super._head.add(newElement);
 
 	if (depth > 0) // current is a nested transaction
@@ -175,12 +175,12 @@
 	     */
 
 	    ServerRestrictedNestedAction nestedAction = null;
-    
+
 	    for (int i = depth -2; i >= 0; i--)
 	    {
 		tmpCoord = ctx.parents[i].coord;
 		tmpTerm = ctx.parents[i].term;
-		
+
 		control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.parents[i].otid),
 								  tmpCoord, tmpTerm, control);
 
@@ -193,7 +193,7 @@
 		     * registered successfully, and will be deal with automatically
 		     * when the parent transaction terminates.
 		     */
-		
+
 		    try
 		    {
 			nestedAction.rollback();
@@ -202,10 +202,10 @@
 		    catch (Exception e)
 		    {
 		    }
-	
+
 		    throw new TRANSACTION_ROLLEDBACK();
 		}
-		
+
 		/*
 		 * Add transaction resource to list.
 		 */
@@ -219,7 +219,7 @@
 
 	    tmpCoord = ctx.current.coord;
 	    tmpTerm = ctx.current.term;
-	    
+
 	    control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.current.otid),
 							      tmpCoord, tmpTerm, control);
 	    nestedAction = new ServerRestrictedNestedAction(control);
@@ -231,7 +231,7 @@
 		 * registered successfully, and will be deal with automatically
 		 * when the parent transaction terminates.
 		 */
-		
+
 		try
 		{
 		    nestedAction.rollback();
@@ -240,31 +240,31 @@
 		catch (Exception e)
 		{
 		}
-	
+
 		throw new TRANSACTION_ROLLEDBACK();
 	    }
-	    
+
 	    tlAction.addChild(nestedAction);
 	}
 
 	return control;
     }
-    
+
     /*
      * Work our way down the hierarchy, aborting any actions which are no
      * longer valid, and creating any new ones. These new actions must be
      * nested actions.
      */
-    
-protected synchronized ControlImple checkHierarchy (InterposedHierarchy hier,
+
+protected synchronized ControlImple checkHierarchy (ServerTopLevelAction hier,
 						   PropagationContext context) throws SystemException
     {
-	ServerRestrictedTopLevelAction tlAction = (ServerRestrictedTopLevelAction) hier.action();
+	ServerRestrictedTopLevelAction tlAction = (ServerRestrictedTopLevelAction) hier;
 	ServerControl control = tlAction.control();  // top-level's control
 	int depth = context.parents.length;
 	int differenceIndex = -1;  // index of the new transactions in the hierarchy
 	ServerRestrictedNestedAction nestedAction = tlAction.child();  // top-level's nested action
-	
+
 	/*
 	 * Abort any old actions before we check whether we need to create
 	 * additional ones.
@@ -299,7 +299,7 @@
 	     * which is 0 to n-1, and the n-1th element is the top-level
 	     * transaction, which we have dealt with to get this far.
 	     */
-	    
+
 	    for (int i = depth -2; (i >= 0) && (nestedAction != null); i--)
 	    {
 		if (nestedAction.get_uid().equals(Utility.otidToUid(context.parents[i].otid)))
@@ -324,13 +324,13 @@
 		     * hierarchy, as aborting from this point will implicitly
 		     * abort out children.
 		     */
-		
+
 		    differenceIndex = i;    // remember for later so that we can add new actions.
 
 		    tlAction.abortChild(nestedAction);
 		    nestedAction = null;
 		    control = tlAction.deepestControl();
-		    
+
 		    break;
 		}
 	    }
@@ -344,16 +344,16 @@
 	    {
 		Coordinator tmpCoord;
 		Terminator tmpTerm;
-		
+
 		for (int j = differenceIndex; j >= 0; j--)
 		{
 		    tmpCoord = context.parents[j].coord;
 		    tmpTerm = context.parents[j].term;
-		    
+
 		    control = ServerFactory.create_subtransaction(Utility.otidToUid(context.parents[j].otid),
 								      tmpCoord, tmpTerm, control);
 		    nestedAction = new ServerRestrictedNestedAction(control);
-		    
+
 		    if (!nestedAction.valid())
 		    {
 			/*
@@ -361,7 +361,7 @@
 			 * registered successfully, and will be deal with automatically
 			 * when the parent transaction terminates.
 			 */
-		
+
 			try
 			{
 			    nestedAction.rollback();  // does dispose as well!
@@ -370,7 +370,7 @@
 			catch (Exception e)
 			{
 			}
-	
+
 			throw new TRANSACTION_ROLLEDBACK();
 		    }
 
@@ -388,9 +388,9 @@
 		     * abort it, since it does not exist in the hierarchy
 		     * we have just received.
 		     */
-		    
+
 		    nestedAction = nestedAction.child();
-		    
+
 		    if (nestedAction != null)
 		    {
 			tlAction.abortChild(nestedAction);
@@ -401,7 +401,7 @@
 	    }
 	}
 
-	boolean newCurrent = false;	
+	boolean newCurrent = false;
 	Uid sentCurrent = Utility.otidToUid(context.current.otid);
 
 	/*
@@ -409,7 +409,7 @@
 	 * between the sent hierarchy and the one we already had, so we
 	 * must have a new current.
 	 */
-	
+
 	if (differenceIndex == -1)
 	{
 	    /*
@@ -421,11 +421,11 @@
 	    /*
 	     * Get hold of our local notion of current.
 	     */
-	
+
 	    if (nestedAction == null)
 	    {
 		nestedAction = tlAction.child();
-		
+
 		if (nestedAction != null)
 		{
 		    while (nestedAction.child() != null)
@@ -438,7 +438,7 @@
 	    }
 	    else
 		currentUid = nestedAction.get_uid();
-	
+
 	    /*
 	     * Is our notion of the current transaction the same as
 	     * that sent?
@@ -459,7 +459,7 @@
 		/*
 		 * Old current is gone.
 		 */
-		
+
 		nestedAction = tlAction.child();
 
 		if (nestedAction != null)
@@ -467,18 +467,18 @@
 		    tlAction.abortChild(nestedAction);
 		    nestedAction = null;
 		}
-	    
+
 		control = (ServerControl) tlAction.control();
 	    }
 	    else
 		control = tlAction.deepestControl();
-	    
+
 	    TransIdentity currentID = context.current;
-	    
+
 	    control = ServerFactory.create_subtransaction(sentCurrent,
 							      currentID.coord, currentID.term, control);
 	    nestedAction = new ServerRestrictedNestedAction(control);
-	    
+
 	    if (!nestedAction.valid())
 	    {
 		/*
@@ -486,7 +486,7 @@
 		 * registered successfully, and will be deal with automatically
 		 * when the parent transaction terminates.
 		 */
-		
+
 		try
 		{
 		    nestedAction.rollback();  // does dispose as well!
@@ -495,7 +495,7 @@
 		catch (Exception e)
 		{
 		}
-	
+
 		throw new TRANSACTION_ROLLEDBACK();
 	    }
 

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/strict/StrictInterposition.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/strict/StrictInterposition.java	2009-05-18 13:31:23 UTC (rev 26588)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/resources/strict/StrictInterposition.java	2009-05-18 14:05:03 UTC (rev 26589)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -24,7 +24,7 @@
  * Arjuna Solutions Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
- * UK.  
+ * UK.
  *
  * $Id: StrictInterposition.java 2342 2006-03-30 13:06:17Z  $
  */
@@ -77,8 +77,8 @@
 protected StrictInterposition ()
     {
     }
-    
-protected ControlImple createHierarchy (PropagationContext ctx, Uid currentUid) throws SystemException
+
+protected synchronized ControlImple createHierarchy (PropagationContext ctx, Uid currentUid) throws SystemException
     {
 	/*
 	 * Start at the parent and work our way down to "current". The current
@@ -98,7 +98,7 @@
 	ServerResource action = null;
 	Coordinator tmpCoord = null;
 	Terminator tmpTerm = null;
-	
+
 	/*
 	 * First deal with top-level transaction, which may be
 	 * the current transaction.
@@ -117,7 +117,7 @@
 
 	if (tmpCoord == null)  // terminator my correctory be null
 	    return null;
-	
+
 	ServerControl control = ServerFactory.create_transaction(currentUid, null, null,
 									 tmpCoord, tmpTerm,
 									 ctx.timeout);
@@ -137,9 +137,9 @@
 
 	    throw new TRANSACTION_ROLLEDBACK();
 	}
-	
-	InterposedHierarchy newElement = new InterposedHierarchy((ServerStrictTopLevelAction) action);
-    
+
+	ServerTopLevelAction newElement = (ServerStrictTopLevelAction)action;
+
 	_head.add(newElement);
 
 	if (depth > 0)  // current is a nested transaction
@@ -150,7 +150,7 @@
 	     */
 
 	    ServerResource nestedAction = null;
-	    
+
 	    for (int i = depth -2; i >= 0; i--)
 	    {
 		tmpCoord = ctx.parents[i].coord;
@@ -158,7 +158,7 @@
 
 		control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.parents[i].otid),
 								  tmpCoord, tmpTerm, control);
-	    
+
 		nestedAction = new ServerStrictNestedAction(control, false);  // not current, so don't register
 
 		if (!nestedAction.valid())
@@ -168,7 +168,7 @@
 		     * registered successfully, and will be deal with automatically
 		     * when the parent transaction terminates.
 		     */
-		
+
 		    try
 		    {
 			((ServerStrictNestedAction) nestedAction).rollback_subtransaction();  // does dispose as well!
@@ -199,7 +199,7 @@
 
 	    control = ServerFactory.create_subtransaction(Utility.otidToUid(ctx.current.otid),
 							      tmpCoord, tmpTerm, control);
-	
+
 	    nestedAction = new ServerStrictNestedAction(control, true);  // current, so register
 
 	    if (!nestedAction.valid())
@@ -209,7 +209,7 @@
 		 * registered successfully, and will be deal with automatically
 		 * when the parent transaction terminates.
 		 */
-		
+
 		try
 		{
 		    ((ServerStrictNestedAction) nestedAction).rollback_subtransaction();  // does dispose as well!
@@ -221,20 +221,20 @@
 
 		throw new TRANSACTION_ROLLEDBACK();
 	    }
-	
+
 	    action.addChild((ServerStrictNestedAction) nestedAction);
 	}
 
 	if (jtsLogger.logger.isDebugEnabled())
 	    compareHierarchies(ctx, newElement);
-	
+
 	/*
 	 * Always return reference to 'current' transaction.
 	 */
 
 	return control;
     }
-    
+
 /*
  * In a single threaded environment we could walk down the hierarchy, aborting
  * any actions which are no longer valid, and creating any new ones. However,
@@ -264,11 +264,11 @@
  * hierarchy at the server, so if it makes subsequent invocations, the right
  * hierarchy gets sent out!
  */
-    
-protected ControlImple checkHierarchy (InterposedHierarchy hier, PropagationContext context)
+
+protected synchronized ControlImple checkHierarchy (ServerTopLevelAction hier, PropagationContext context)
     {
 	ServerControl control = null;
-	ServerResource currentAction = hier.action();  // top-level transaction
+	ServerResource currentAction = hier;  // top-level transaction
 	int depth = context.parents.length;
 	int differenceIndex = -1;  // index of the new transactions in the hierarchy
 
@@ -292,16 +292,16 @@
 	     * itself with the "real" transaction.
 	     */
 
-	    ServerStrictTopLevelAction tx = (ServerStrictTopLevelAction) hier.action();
+	    ServerStrictTopLevelAction tx = (ServerStrictTopLevelAction) hier;
 
 	    tx.interposeResource();
-	
+
 	    control = tx.control();  // top-level transaction's control
 	}
 	else
 	{
 	    ServerResource nestedAction = null;
-	
+
 	    /*
 	     * Start at -2 and work our way down the hierarchy. We
 	     * use -2 since the length gives us the *number* of elements,
@@ -312,7 +312,7 @@
 	    for (int i = (int) depth -2; i >= 0; i--)  // don't check depth-1 as it is current action!
 	    {
 		nestedAction = currentAction.getChild(Utility.otidToUid(context.parents[i].otid));
-		
+
 		if (nestedAction == null)  // point of difference, so stop trawling hierarchy
 		{
 		    differenceIndex = i;   // remember for later so that we can add new actions.
@@ -324,7 +324,7 @@
 		     * currentAction *always* points to the last known
 		     * good transaction in our hierarchy.
 		     */
-		
+
 		    currentAction = nestedAction;
 		}
 	    }
@@ -340,7 +340,7 @@
 
 		Coordinator tmpCoord = null;
 		Terminator tmpTerm = null;
-		
+
 		for (int j = differenceIndex; j >= 0; j--)
 		{
 		    tmpCoord = context.parents[j].coord;
@@ -348,9 +348,9 @@
 
 		    control = ServerFactory.create_subtransaction(Utility.otidToUid(context.parents[j].otid),
 								      tmpCoord, tmpTerm, control);
-		
+
 		    nestedAction = new ServerStrictNestedAction(control, false);
-		    
+
 		    if (!nestedAction.valid())
 		    {
 			/*
@@ -358,7 +358,7 @@
 			 * registered successfully, and will be deal with automatically
 			 * when the parent transaction terminates.
 			 */
-		
+
 			try
 			{
 			    ((ServerStrictNestedAction) nestedAction).rollback();  // does dispose as well!
@@ -382,7 +382,7 @@
 		 * Remember to check!
 		 */
 	    }
-	
+
 	    Uid currentUid = Utility.otidToUid(context.current.otid);
 
 	    /*
@@ -391,18 +391,18 @@
 	     * structure. So, ask it if the sent hierarchy's child is
 	     * one of its children.
 	     */
-	
+
 	    nestedAction = currentAction.getChild(currentUid);
-	
+
 	    if (nestedAction == null)
 	    {
 		/*
 		 * Different notion of current in sent hierarchy.
 		 * So, add it to the hierarchy here.
 		 */
-	    
+
 		control = currentAction.control();
-		
+
 		/*
 		 * Now deal with the current transaction.
 		 */
@@ -410,7 +410,7 @@
 		TransIdentity currentID = context.current;
 
 		control = ServerFactory.create_subtransaction(currentUid, currentID.coord, currentID.term, control);
-	    
+
 		nestedAction = new ServerStrictNestedAction(control, true);
 
 		if (!nestedAction.valid())
@@ -420,7 +420,7 @@
 		     * registered successfully, and will be deal with automatically
 		     * when the parent transaction terminates.
 		     */
-		
+
 		    try
 		    {
 			((ServerStrictNestedAction) nestedAction).rollback();  // does dispose as well!
@@ -432,7 +432,7 @@
 
 		    throw new TRANSACTION_ROLLEDBACK();
 		}
-		
+
 		currentAction.addChild((ServerStrictNestedAction) nestedAction);
 	    }
 	    else
@@ -444,7 +444,7 @@
 		 */
 
 		nestedAction.interposeResource();
-	    
+
 		control = nestedAction.control();
 	    }
 	}
@@ -456,5 +456,5 @@
     }
 
 private static StrictInterposition __list = new StrictInterposition();
- 
+
 }

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedNestedAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedNestedAction.java	2009-05-18 13:31:23 UTC (rev 26588)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedNestedAction.java	2009-05-18 14:05:03 UTC (rev 26589)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -24,7 +24,7 @@
  * Arjuna Solutions Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
- * UK.  
+ * UK.
  *
  * $Id: ServerRestrictedNestedAction.java 2342 2006-03-30 13:06:17Z  $
  */
@@ -52,9 +52,11 @@
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.UNKNOWN;
 
+import java.util.List;
+
 public class ServerRestrictedNestedAction extends ServerNestedAction
 {
-    
+
     /*
      * Create local transactions with same ids as remote.
      */
@@ -85,34 +87,28 @@
      * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_1 {0} Concurrent children found for restricted interposition!
      */
 
-public final synchronized ServerRestrictedNestedAction child ()
+    public final synchronized ServerRestrictedNestedAction child ()
     {
-	ServerRestrictedNestedAction toReturn = null;
-	HashList children = getChildren();
-    
-	/*
-	 * There should be only one child!
-	 */
-    
-	if (children != null)
-	{
-	    if (children.size() != 1)
-	    {
-		if (jtsLogger.loggerI18N.isWarnEnabled())
-		{
-		    jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_1",
-					      new Object[] {"ServerRestrictedNestedAction.child"});
-		}
+        ServerRestrictedNestedAction toReturn = null;
+        List<ServerNestedAction> children = getChildren();
 
-		throw new com.arjuna.ats.jts.exceptions.TxError(jtsLogger.logMesg.getString("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_2"));
-	    }
-	    else
-	    {
-		toReturn = (ServerRestrictedNestedAction) children.orderedPop();
-	    }
-	}
-    
-	return toReturn;
+        // There should be only one child!
+        if (children.size() != 1)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_1",
+                        new Object[] {"ServerRestrictedNestedAction.child"});
+            }
+
+            throw new com.arjuna.ats.jts.exceptions.TxError(jtsLogger.logMesg.getString("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_2"));
+        }
+        else
+        {
+            toReturn = (ServerRestrictedNestedAction) children.remove(0);
+        }
+
+        return toReturn;
     }
-    
+
 }

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedTopLevelAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedTopLevelAction.java	2009-05-18 13:31:23 UTC (rev 26588)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/resources/restricted/ServerRestrictedTopLevelAction.java	2009-05-18 14:05:03 UTC (rev 26589)
@@ -1,8 +1,8 @@
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a full listing 
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
  * of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -52,6 +52,8 @@
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.UNKNOWN;
 
+import java.util.List;
+
 /*
  * This looks like an atomic action, but is not actually derived from
  * BasicAction or Transaction. This is because of the way in which the
@@ -96,42 +98,35 @@
      * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_3 {0} - found concurrent transactions!
      * @message com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_4 {0} Concurrent children found for restricted interposition!
      */
-
-public final synchronized ServerRestrictedNestedAction child ()
+    public final synchronized ServerRestrictedNestedAction child ()
     {
-	ServerRestrictedNestedAction toReturn = null;
-	HashList children = getChildren();
-    
-	/*
-	 * There should be only one child!
-	 */
-    
-	if (children != null)
-	{
-	    if (children.size() != 1)
-	    {
-		if (jtsLogger.loggerI18N.isWarnEnabled())
-		{
-		    jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_3",
-					      new Object[] {"ServerRestrictedTopLevelAction.child"});
-		}
+        ServerRestrictedNestedAction toReturn = null;
+        List<ServerNestedAction> children = getChildren();
 
-		throw new com.arjuna.ats.jts.exceptions.TxError(jtsLogger.logMesg.getString("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_4"));
-	    }
-	    else
-	    {
-		toReturn = (ServerRestrictedNestedAction) children.orderedPop();
-	    }
-	}
-    
-	return toReturn;
+        // There should be only one child!
+        if (children.size() != 1)
+        {
+            if (jtsLogger.loggerI18N.isWarnEnabled())
+            {
+                jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contxfound_3",
+                        new Object[] {"ServerRestrictedTopLevelAction.child"});
+            }
+
+            throw new com.arjuna.ats.jts.exceptions.TxError(jtsLogger.logMesg.getString("com.arjuna.ats.internal.jts.orbspecific.interposition.resources.restricted.contx_4"));
+        }
+        else
+        {
+            toReturn = (ServerRestrictedNestedAction) children.remove(0);
+        }
+
+        return toReturn;
     }
 
 public String type ()
     {
 	return "/Resources/Arjuna/ServerTopLevelAction/ServerRestrictedTopLevelAction";
     }
-    
+
 }
 
 




More information about the jboss-svn-commits mailing list