[jboss-svn-commits] JBL Code SVN: r14987 - in labs/jbosstm/trunk/XTS: WSAS/classes/com/arjuna/mw/wsas/exceptions and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 10 05:50:50 EDT 2007


Author: jhalliday
Date: 2007-09-10 05:50:50 -0400 (Mon, 10 Sep 2007)
New Revision: 14987

Added:
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/SystemCommunicationException.java
   labs/jbosstm/trunk/XTS/WSAS/classes/com/arjuna/mw/wsas/exceptions/SystemCommunicationException.java
Modified:
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Durable2PCStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/ParticipantStub.java
   labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/ParticipantRecord.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/DurableTwoPhaseCommitParticipant.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/remote/UserTransactionImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/util/PersistableParticipantHelper.java
Log:
Assorted fixes relating to coordinator crash recovery support.


Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Durable2PCStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Durable2PCStub.java	2007-09-10 09:13:32 UTC (rev 14986)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/Durable2PCStub.java	2007-09-10 09:50:50 UTC (rev 14987)
@@ -1,20 +1,20 @@
 /*
  * 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
  * of the GNU General Public License, v. 2.0.
- * 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 
+ * 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 General Public License for more details.
  * You should have received a copy of the GNU General Public License,
  * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -33,6 +33,11 @@
 
 public class Durable2PCStub extends ParticipantStub implements Durable2PCParticipant
 {
+    // default ctor for crash recovery
+    public Durable2PCStub() throws Exception {
+        super(null, true, null);
+    }
+
     public Durable2PCStub(final String id, final EndpointReferenceType twoPCParticipant)
         throws Exception
     {

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/ParticipantStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/ParticipantStub.java	2007-09-10 09:13:32 UTC (rev 14986)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/ParticipantStub.java	2007-09-10 09:50:50 UTC (rev 14987)
@@ -1,20 +1,20 @@
 /*
  * 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
  * of the GNU General Public License, v. 2.0.
- * 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 
+ * 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 General Public License for more details.
  * You should have received a copy of the GNU General Public License,
  * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -56,7 +56,7 @@
 {
     private static final QName QNAME_TWO_PC_PARTICIPANT = new QName("twoPCParticipant") ;
     private CoordinatorEngine coordinator ;
-    
+
     public ParticipantStub(final String id, final boolean durable, final EndpointReferenceType twoPCParticipant)
         throws Exception
     {
@@ -122,7 +122,10 @@
         {
             if (state == State.STATE_COMMITTING)
             {
-                throw new SystemException() ;
+                // typically means no response from the remote end.
+                // throw a comm exception to distinguish this case from the
+                // one where the remote end itself threw a SystemException.
+                throw new SystemCommunicationException();
             }
             else
             {
@@ -172,7 +175,7 @@
         }
         catch (final WrongStateException wse) {} // ignore
     }
-    
+
     /**
      * @message com.arjuna.wst.stub.ParticipantStub_1 [com.arjuna.wst.stub.ParticipantStub_1] - Error persisting participant state
      */
@@ -182,16 +185,19 @@
         {
             oos.packString(coordinator.getId()) ;
             oos.packBoolean(coordinator.isDurable()) ;
-            
+
             final StringWriter sw = new StringWriter() ;
             final XMLStreamWriter writer = SoapUtils.getXMLStreamWriter(sw) ;
             StreamHelper.writeStartElement(writer, QNAME_TWO_PC_PARTICIPANT) ;
             coordinator.getParticipant().writeContent(writer) ;
             StreamHelper.writeEndElement(writer, null, null) ;
             writer.close() ;
-            
-            oos.packString(writer.toString()) ;
-            
+            sw.close();
+
+            String tmp = writer.toString();
+            String swString = sw.toString();
+            oos.packString(swString) ;
+
             return true ;
         }
         catch (final Throwable th)
@@ -200,7 +206,7 @@
             return false ;
         }
     }
-    
+
     /**
      * @message com.arjuna.wst.stub.ParticipantStub_2 [com.arjuna.wst.stub.ParticipantStub_2] - Error restoring participant state
      */
@@ -211,11 +217,11 @@
             final String id = ios.unpackString() ;
             final boolean durable = ios.unpackBoolean() ;
             final String eprValue = ios.unpackString() ;
-            
+
             final XMLStreamReader reader = SoapUtils.getXMLStreamReader(new StringReader(eprValue)) ;
             StreamHelper.checkNextStartTag(reader, QNAME_TWO_PC_PARTICIPANT) ;
             final EndpointReferenceType endpointReferenceType = new EndpointReferenceType(reader) ;
-            
+
             coordinator = new CoordinatorEngine(id, durable, endpointReferenceType, State.STATE_PREPARED_SUCCESS) ;
             return true ;
         }

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/SystemCommunicationException.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/SystemCommunicationException.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/wst/stub/SystemCommunicationException.java	2007-09-10 09:50:50 UTC (rev 14987)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2007,
+ * @author JBoss, a division of Red Hat.
+ */
+package com.arjuna.wst.stub;
+
+import com.arjuna.wst.SystemException;
+
+/**
+ * Marker interface for exceptions e.g. timeouts, in the client/server communication.
+ */
+public class SystemCommunicationException extends SystemException {
+}

Added: labs/jbosstm/trunk/XTS/WSAS/classes/com/arjuna/mw/wsas/exceptions/SystemCommunicationException.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSAS/classes/com/arjuna/mw/wsas/exceptions/SystemCommunicationException.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WSAS/classes/com/arjuna/mw/wsas/exceptions/SystemCommunicationException.java	2007-09-10 09:50:50 UTC (rev 14987)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2007,
+ * @author JBoss, a division of Red Hat.
+ */
+package com.arjuna.mw.wsas.exceptions;
+
+/**
+ * Marker interface for exceptions e.g. timeouts, in the client/server communication.
+ */
+public class SystemCommunicationException extends SystemException {
+
+	public SystemCommunicationException ()
+	{
+		super();
+	}
+
+	public SystemCommunicationException (String s)
+	{
+		super(s);
+	}
+
+	public SystemCommunicationException (String s, int errorcode)
+	{
+		super(s, errorcode);
+	}
+
+	public SystemCommunicationException (String reason, Object obj)
+	{
+		super(reason, obj);
+	}
+
+	public SystemCommunicationException (Object ex)
+	{
+		super(ex);
+	}
+
+}

Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/ParticipantRecord.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/ParticipantRecord.java	2007-09-10 09:13:32 UTC (rev 14986)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/ParticipantRecord.java	2007-09-10 09:50:50 UTC (rev 14987)
@@ -1,20 +1,20 @@
 /*
  * 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
  * of the GNU General Public License, v. 2.0.
- * 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 
+ * 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 General Public License for more details.
  * You should have received a copy of the GNU General Public License,
  * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -51,7 +51,7 @@
 
 /**
  * Arjuna abstract record to handle two-phase participants.
- * 
+ *
  * @author Mark Little (mark.little at arjuna.com)
  * @version $Id: ParticipantRecord.java,v 1.11 2005/06/09 09:41:27 nmcl Exp $
  */
@@ -62,10 +62,10 @@
 
 	/**
 	 * Constructor.
-	 * 
+	 *
 	 * @param theResource
 	 *            is the proxy that allows us to call out to the object.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_1
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_1] -
 	 *          ParticipantRecord {0} - null participant provided!
@@ -107,7 +107,7 @@
 	public int typeIs ()
 	{
 		// TODO add specific record type.
-		
+
 		return RecordType.USER_DEF_FIRST0;
 	}
 
@@ -131,7 +131,7 @@
 
 	/**
 	 * Set the internal value. Not allowed for this class.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_2
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_2] -
 	 *          ParticipantRecord.setValue() called illegally.
@@ -144,7 +144,7 @@
 
 	/**
 	 * The record is being driven through nested rollback.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_3
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_3] -
 	 *          ParticipantRecord.nestedAbort {0} caught: {1}
@@ -175,7 +175,7 @@
 
 	/**
 	 * The record is being driven through nested commit.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_4
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_4] -
 	 *          ParticipantRecord.nestedCommit {0} caught: {1}
@@ -205,7 +205,7 @@
 
 	/**
 	 * The record is being driven through nested prepare.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_5
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_5] -
 	 *          ParticipantRecord.nestedPrepare {0} caught: {1}
@@ -235,7 +235,7 @@
 
 	/**
 	 * The record is being driven through top-level rollback.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_6
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_6] -
 	 *          ParticipantRecord.topLevelAbort {0} caught: {1}
@@ -295,7 +295,7 @@
 
 	/**
 	 * The record is being driven through top-level commit.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_7
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_7] -
 	 *          ParticipantRecord.topLevelCommit {0} caught: {1}
@@ -321,7 +321,7 @@
 				}
 				catch (WrongStateException ex)
 				{
-					return TwoPhaseOutcome.NOT_PREPARED;
+					return TwoPhaseOutcome.NOT_PREPARED; // should be HEURISTIC_HAZARD?
 				}
 				catch (HeuristicHazardException ex)
 				{
@@ -335,7 +335,11 @@
 				{
 					return TwoPhaseOutcome.HEURISTIC_ROLLBACK;
 				}
-				catch (SystemException ex)
+                catch(SystemCommunicationException ex)
+                {
+                    return TwoPhaseOutcome.FINISH_ERROR;
+                }
+                catch (SystemException ex)
 				{
 					return TwoPhaseOutcome.HEURISTIC_HAZARD;
 				}
@@ -358,14 +362,14 @@
 
 	/**
 	 * The record is being driven through top-level prepare.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_8
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_8] -
 	 *          ParticipantRecord.topLevelPrepare {0} caught: {1}
 	 */
 
 	public int topLevelPrepare ()
-	{	
+	{
 		try
 		{
 			if (_resourceHandle != null)
@@ -438,7 +442,7 @@
 	/**
 	 * The record is being driven through nested commit and is the only
 	 * resource.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_9
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_9] -
 	 *          ParticipantRecord.nestedOnePhaseCommit {0} caught: {1}
@@ -469,18 +473,18 @@
 	/**
 	 * The record is being driven through top-level commit and is the only
 	 * resource.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_10
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_10] -
 	 *          ParticipantRecord.topLevelOnePhaseCommit {0} caught: {1}
 	 */
 
 	public int topLevelOnePhaseCommit ()
-	{	
+	{
 		try
-		{		
+		{
 			if (_resourceHandle != null)
-			{			
+			{
 				if (_rolledback)
 					return TwoPhaseOutcome.FINISH_ERROR;
 
@@ -504,7 +508,7 @@
 					return TwoPhaseOutcome.HEURISTIC_HAZARD;
 				}
 				catch (HeuristicMixedException ex)
-				{					
+				{
 					return TwoPhaseOutcome.HEURISTIC_MIXED;
 				}
 				catch (HeuristicCancelException ex)
@@ -539,7 +543,7 @@
 
 	/**
 	 * The record generated a heuristic and can now forget about it.
-	 * 
+	 *
 	 * @message com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_11
 	 *          [com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord_11] -
 	 *          ParticipantRecord.forgetHeuristic for {0} called without a
@@ -623,8 +627,11 @@
 		{
 			try
 			{
-				result = _resourceHandle.restore_state(os);
-				
+                String resourcehandleImplClassName = os.unpackString();
+                _resourceHandle = (Participant)Class.forName(resourcehandleImplClassName).newInstance();
+
+                result = _resourceHandle.restore_state(os);
+
 				if (result)
 					_timeout = os.unpackLong();
 
@@ -658,8 +665,9 @@
 		{
 			try
 			{
-				result = _resourceHandle.save_state(os);
-				
+                os.packString(_resourceHandle.getClass().getName()); // TODO: a shorter value whould be more efficient.
+                result = _resourceHandle.save_state(os);
+
 				if (result)
 					os.packLong(_timeout);
 

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/DurableTwoPhaseCommitParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/DurableTwoPhaseCommitParticipant.java	2007-09-10 09:13:32 UTC (rev 14986)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/participants/DurableTwoPhaseCommitParticipant.java	2007-09-10 09:50:50 UTC (rev 14987)
@@ -1,20 +1,20 @@
 /*
  * 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
  * of the GNU General Public License, v. 2.0.
- * 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 
+ * 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 General Public License for more details.
  * You should have received a copy of the GNU General Public License,
  * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -43,6 +43,7 @@
 
 import com.arjuna.mw.wsas.exceptions.SystemException;
 import com.arjuna.mw.wsas.exceptions.WrongStateException;
+import com.arjuna.mw.wsas.exceptions.SystemCommunicationException;
 import com.arjuna.mwlabs.wst.util.PersistableParticipantHelper;
 
 /**
@@ -54,8 +55,11 @@
 
 public class DurableTwoPhaseCommitParticipant implements Participant
 {
+    // default ctor for crash recovery
+    public DurableTwoPhaseCommitParticipant() {
+    }
 
-	public DurableTwoPhaseCommitParticipant (Durable2PCParticipant resource, String identifier)
+    public DurableTwoPhaseCommitParticipant (Durable2PCParticipant resource, String identifier)
 	{
 		_resource = resource;
 		_id = identifier;
@@ -64,13 +68,13 @@
 	public Vote prepare () throws InvalidParticipantException,
 			WrongStateException, HeuristicHazardException,
 			HeuristicMixedException, SystemException
-	{		
+	{
 		try
 		{
 			if (_resource != null)
 			{
 				com.arjuna.wst.Vote vt = _resource.prepare();
-			
+
 				if (vt instanceof com.arjuna.wst.ReadOnly)
 				{
 					_readonly = true;
@@ -113,13 +117,13 @@
 	public void confirm () throws InvalidParticipantException,
 			WrongStateException, HeuristicHazardException,
 			HeuristicMixedException, HeuristicCancelException, SystemException
-	{	
+	{
 		if (_resource != null)
 		{
 			try
-			{				
+			{
 				if (!_readonly)
-				{			
+				{
 					_resource.commit();
 				}
 			}
@@ -139,8 +143,12 @@
 			//	    catch (com.arjuna.mw.wst.exceptions.SystemException ex)
 			catch (com.arjuna.wst.SystemException ex)
 			{
-				throw new SystemException(ex.toString());
-			}
+				if(ex instanceof com.arjuna.wst.stub.SystemCommunicationException) {
+                    throw new SystemCommunicationException(ex.toString());
+                } else {
+                    throw new SystemException(ex.toString());
+                }
+            }
 		}
 		else
 			throw new InvalidParticipantException();
@@ -181,7 +189,7 @@
 	}
 
 	// TODO mark ParticipantCancelledException explicitly?
-	
+
 	public void confirmOnePhase () throws InvalidParticipantException,
 			WrongStateException, HeuristicHazardException,
 			HeuristicMixedException, HeuristicCancelException, SystemException
@@ -197,10 +205,10 @@
 			catch (Exception ex)
 			{
 				ex.printStackTrace();
-				
+
 				v = new VoteCancel();
 			}
-				
+
                         if (v instanceof VoteReadOnly)
                         {
                             _readonly = true;
@@ -210,13 +218,13 @@
 				_rolledback = false;
 
 				// TODO only do this if we didn't return VoteCancel
-				
+
 				cancel();
 
 				throw new ParticipantCancelledException();
 			}
 			else
-			{			
+			{
 				if (v instanceof VoteConfirm)
 				{
 					try
@@ -236,14 +244,14 @@
 						throw ex;
 					}
 					catch (Exception ex)
-					{						
+					{
 						throw new HeuristicHazardException();
 					}
 				}
 				else
 				{
 					cancel(); // TODO error
-					
+
 					throw new HeuristicHazardException();
 				}
 			}
@@ -282,13 +290,13 @@
 	{
         return PersistableParticipantHelper.save_state(os, _resource) ;
 	}
-	
+
 	public boolean restore_state (InputObjectState os)
 	{
         _resource = (Durable2PCParticipant)PersistableParticipantHelper.restore_state(os) ;
         return true ;
 	}
-	
+
 	private Durable2PCParticipant _resource;
 	private String _id;
 	private boolean _readonly;

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/remote/UserTransactionImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/remote/UserTransactionImple.java	2007-09-10 09:13:32 UTC (rev 14986)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/at/remote/UserTransactionImple.java	2007-09-10 09:50:50 UTC (rev 14987)
@@ -1,20 +1,20 @@
 /*
  * 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
  * of the GNU General Public License, v. 2.0.
- * 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 
+ * 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 General Public License for more details.
  * You should have received a copy of the GNU General Public License,
  * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -32,6 +32,7 @@
 package com.arjuna.mwlabs.wst.at.remote;
 
 import java.util.Hashtable;
+import java.io.InputStream;
 
 import com.arjuna.ats.arjuna.common.Uid;
 import com.arjuna.mw.wst.TransactionManager;
@@ -105,7 +106,7 @@
 			com.arjuna.mw.wsc.context.Context ctx = startTransaction(timeout);
 
 			_ctxManager.resume(new TxContextImple(ctx));
-			
+
 			enlistCompletionParticipants();
 		}
 		catch (com.arjuna.wsc.InvalidCreateParametersException ex)
@@ -192,12 +193,12 @@
 			SystemException
 	{
 		try
-		{		
+		{
 			TransactionManagerImple tm = (TransactionManagerImple) TransactionManager.getTransactionManager();
 
 			final String id = ((TxContextImple) tm.currentTransaction()).identifier();
 			final EndpointReferenceType completionCoordinator = tm.enlistForCompletion(getCompletionParticipant(id));
-			
+
 			_completionCoordinators.put(id, completionCoordinator);
 		}
 		catch (com.arjuna.wsc.AlreadyRegisteredException ex)
@@ -212,6 +213,10 @@
 	{
 		try
 		{
+            // TODO: tricks for per app _activationCoordinatorService config, perhaps:
+            //InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("/foo.properties");
+
+            
             final Long expires = (timeout > 0 ? new Long(timeout) : null) ;
             final String messageId = new Uid().stringForm() ;
             final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(
@@ -243,12 +248,12 @@
 	{
 		TxContextImple ctx = null;
 		String id = null;
-		
+
 		try
-		{			
-			ctx = (TxContextImple) _ctxManager.suspend();			
+		{
+			ctx = (TxContextImple) _ctxManager.suspend();
 			id = ctx.identifier();
-			
+
 			/*
 			 * By default the completionParticipantURL won't be set for an interposed (imported)
 			 * bridged transaction. This is fine, because you shouldn't be able to commit that
@@ -257,9 +262,9 @@
 			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
 			 * for how to do this).
 			 */
-			
+
 			final EndpointReferenceType completionCoordinator = (EndpointReferenceType) _completionCoordinators.get(id);
-			
+
 			if (completionCoordinator == null)
 				throw new SecurityException();
 
@@ -286,7 +291,7 @@
 		catch (Exception ex)
 		{
 			ex.printStackTrace();
-			
+
 			throw new SystemException(ex.toString());
 		}
 		finally
@@ -300,7 +305,7 @@
 			{
 				ex.printStackTrace();
 			}
-			
+
 			if (id != null)
 				_completionCoordinators.remove(id);
 		}
@@ -311,12 +316,12 @@
 	{
 		TxContextImple ctx = null;
 		String id = null;
-		
+
 		try
 		{
 			ctx = (TxContextImple) _ctxManager.suspend();
 			id = ctx.identifier();
-			
+
 			/*
 			 * By default the completionParticipantURL won't be set for an interposed (imported)
 			 * bridged transaction. This is fine, because you shouldn't be able to commit that
@@ -325,9 +330,9 @@
 			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
 			 * for how to do this).
 			 */
-			
+
 			EndpointReferenceType completionCoordinator = (EndpointReferenceType) _completionCoordinators.get(id);
-			
+
 			if (completionCoordinator == null)
 				throw new SecurityException();
 
@@ -362,7 +367,7 @@
 			{
 				ex.printStackTrace();
 			}
-			
+
 			if (id != null)
 				_completionCoordinators.remove(id);
 		}

Modified: labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/util/PersistableParticipantHelper.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/util/PersistableParticipantHelper.java	2007-09-10 09:13:32 UTC (rev 14986)
+++ labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwlabs/wst/util/PersistableParticipantHelper.java	2007-09-10 09:50:50 UTC (rev 14987)
@@ -1,20 +1,20 @@
 /*
  * 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
  * of the GNU General Public License, v. 2.0.
- * 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 
+ * 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 General Public License for more details.
  * You should have received a copy of the GNU General Public License,
  * v. 2.0 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -106,7 +106,8 @@
             else
             {
                 final String className = ios.unpackString() ;
-                final Object resource = ClassLoaderHelper.forName(PersistableParticipantHelper.class, className) ;
+                final Class resourceClass = ClassLoaderHelper.forName(PersistableParticipantHelper.class, className) ; // returns Class not instance
+                final Object resource = resourceClass.newInstance();
                 ((PersistableParticipant)resource).restoreState(ios) ;
                 return resource ;
             }




More information about the jboss-svn-commits mailing list