[jboss-svn-commits] JBL Code SVN: r25463 - in labs/jbosstm/trunk/XTS: WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/subordinate and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Feb 27 06:58:24 EST 2009


Author: adinn
Date: 2009-02-27 06:58:24 -0500 (Fri, 27 Feb 2009)
New Revision: 25463

Added:
   labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATSubordinateCrashDuringCommit.txt
Modified:
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateDurable2PCStub.java
   labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/subordinate/SubordinateCoordinator.java
   labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java
   labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/RecoverSubordinateCoordinator.java
   labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/SubordinateCoordinatorRecoveryModule.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java
Log:
fixed various problems in SubordinateCoordinator recovery. now manages to restore the subordinate TX and commit it when directed by the parent TX -- fixes JBTM-409

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateDurable2PCStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateDurable2PCStub.java	2009-02-27 11:52:46 UTC (rev 25462)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/SubordinateDurable2PCStub.java	2009-02-27 11:58:24 UTC (rev 25463)
@@ -73,17 +73,25 @@
         if (!isRecovered()) {
             coordinator.commit();
         } else {
-            // first check whether crashed coordinators have been recovered
-            XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
-            boolean isRecoveryScanStarted = recoveryManager.isSubordinateCoordinatorRecoveryStarted();
-            // now look for a subordinate coordinator with the right id
-            coordinator = SubordinateCoordinator.getRecoveredCoordinator(coordinatorId);
+            XTSATRecoveryManager recoveryManager = null;
+            boolean isRecoveryScanStarted = false;
             if (coordinator == null) {
+                // try fetching coordinator from the recovery manager
+                recoveryManager = XTSATRecoveryManager.getRecoveryManager();
+                // check whether recovery has started before we check for the presence
+                // of the subordinate coordinator
+                isRecoveryScanStarted = recoveryManager.isSubordinateCoordinatorRecoveryStarted();
+                coordinator = SubordinateCoordinator.getRecoveredCoordinator(coordinatorId);
+            }
+            if (coordinator == null) {
+                // hmm, still null -- see if we have finished recovery scanning
                 if (!isRecoveryScanStarted) {
                     // the subtransaction may still be waiting to be resolved
                     // throw an exception causing the commit to be retried later
                     throw new SystemException();
                 }
+                // ok we have no transaction to commit so assume we already committed it and
+                // return without error
             } else if(!coordinator.isActivated()) {
                 // the transaction was logged but has not yet been recovered successfully
                 // throw an exception causing the commit to be retried later
@@ -91,7 +99,7 @@
             } else {
                 int status = coordinator.status();
 
-                if (status == ActionStatus.PREPARED) {
+                if (status == ActionStatus.PREPARED || status == ActionStatus.COMMITTING) {
                     // ok, the commit process was not previously initiated so start it now
                     coordinator.commit();
                     status = coordinator.status();
@@ -136,7 +144,10 @@
             } else {
                 int status = coordinator.status();
 
-                if (status == ActionStatus.PREPARED) {
+                if ((status ==  ActionStatus.ABORTED) ||
+                        (status == ActionStatus.H_ROLLBACK) ||
+                        (status == ActionStatus.ABORTING) ||
+                        (status == ActionStatus.ABORT_ONLY)) {
                     // ok, the rollback process was not previously initiated so start it now
                     coordinator.rollback();
                     status = coordinator.status();
@@ -184,7 +195,6 @@
      */
     public boolean restoreState(InputObjectState ios) {
         // restore the subordinate coordinator id so we can check to ensure it has been committed
-        String coordinatorId;
         try {
             coordinatorId = ios.unpackString();
             return true;

Modified: labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/subordinate/SubordinateCoordinator.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/subordinate/SubordinateCoordinator.java	2009-02-27 11:52:46 UTC (rev 25462)
+++ labs/jbosstm/trunk/XTS/WSCF/classes/com/arjuna/mwlabs/wscf/model/twophase/arjunacore/subordinate/SubordinateCoordinator.java	2009-02-27 11:58:24 UTC (rev 25463)
@@ -183,6 +183,11 @@
 		}
 
         this.finalStatus = status;
+
+        // if we have completed then remove the coordinator from the recovered coordinatros table
+        if (status != ActionStatus.COMMITTING) {
+            SubordinateCoordinator.removeRecoveredCoordinator(this);
+        }
 	}
 
     /**
@@ -225,6 +230,9 @@
 			break;
 		}
 
+        // iemove the coordinator from the recovered coordinatros table
+        SubordinateCoordinator.removeRecoveredCoordinator(this);
+        
         this.finalStatus = status;
 	}
 

Modified: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java	2009-02-27 11:52:46 UTC (rev 25462)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java	2009-02-27 11:58:24 UTC (rev 25463)
@@ -109,7 +109,7 @@
     private final Logger log = org.jboss.logging.Logger.getLogger(XTSService.class);
 
     private ACCoordinatorRecoveryModule acCoordinatorRecoveryModule = null;
-    private SubordinateCoordinatorRecoveryModule subordinateCoordinatorRecoveryModule = null;
+    private SubordinateCoordinatorRecoveryModule atSubordinateCoordinatorRecoveryModule = null;
     private ATParticipantRecoveryModule atParticipantRecoveryModule = null;
 
     private BACoordinatorRecoveryModule baCoordinatorRecoveryModule = null;
@@ -261,9 +261,9 @@
         // we don't need to install anything in the Inventory for this recovery module as it
         // uses the same records as those employed by ACCoordinatorRecoveryModule
 
-        subordinateCoordinatorRecoveryModule = new SubordinateCoordinatorRecoveryModule();
+        atSubordinateCoordinatorRecoveryModule = new SubordinateCoordinatorRecoveryModule();
 
-        subordinateCoordinatorRecoveryModule.install();
+        atSubordinateCoordinatorRecoveryModule.install();
 
         // we don't need to install anything in the Inventory for this recovery module as it
         // manages its own ObjectStore records but we do need it to create the recovery manager
@@ -295,13 +295,18 @@
         //  recovery should perform better if we register partiicpants first since this allows the XTS client
         // recovery module to have a try at recreating the participant before its coordinator attempts to
         // talk to it when they are both in the same VM. it also means the participant nay attempt bottom-up
-        // recovery before the coordinator is ready but coordinator recoveyr is probably going to happen quicker.
+        // recovery before the coordinator is ready but coordinator recovery is probably going to happen quicker.
 
+        // similarly, it is better to recreate subordinate coordinators before recreating ordinary coordinators
+        // because the latter may need the former to be present when the parent and subordinate are both in the
+        // same VM.
+
         RecoveryManager.manager().addModule(atParticipantRecoveryModule);
         RecoveryManager.manager().addModule(baParticipantRecoveryModule);
 
+        RecoveryManager.manager().addModule(atSubordinateCoordinatorRecoveryModule);
+
         RecoveryManager.manager().addModule(acCoordinatorRecoveryModule);
-        RecoveryManager.manager().addModule(subordinateCoordinatorRecoveryModule);
         RecoveryManager.manager().addModule(baCoordinatorRecoveryModule);
     }
 
@@ -315,18 +320,18 @@
             // ok, now it is safe to get the recovery manager to uninstall its Implementations from the inventory
             baCoordinatorRecoveryModule.uninstall();
         }
-        if (subordinateCoordinatorRecoveryModule != null) {
-            // remove the module, making sure any scan which might be using it has completed
-            RecoveryManager.manager().removeModule(subordinateCoordinatorRecoveryModule, true);
-            // ok, now it is safe to get the recovery manager to uninstall its Implementations from the inventory
-            subordinateCoordinatorRecoveryModule.uninstall();
-        }
         if (acCoordinatorRecoveryModule != null) {
             // remove the module, making sure any scan which might be using it has completed
             RecoveryManager.manager().removeModule(acCoordinatorRecoveryModule, true);
             // ok, now it is safe to get the recovery manager to uninstall its Implementations from the inventory
             acCoordinatorRecoveryModule.uninstall();
         }
+        if (atSubordinateCoordinatorRecoveryModule != null) {
+            // remove the module, making sure any scan which might be using it has completed
+            RecoveryManager.manager().removeModule(atSubordinateCoordinatorRecoveryModule, true);
+            // ok, now it is safe to get the recovery manager to uninstall its Implementations from the inventory
+            atSubordinateCoordinatorRecoveryModule.uninstall();
+        }
         if (baParticipantRecoveryModule != null) {
             // remove the module, making sure any scan which might be using it has completed
             RecoveryManager.manager().removeModule(baParticipantRecoveryModule, true);

Modified: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/RecoverSubordinateCoordinator.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/RecoverSubordinateCoordinator.java	2009-02-27 11:52:46 UTC (rev 25462)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/RecoverSubordinateCoordinator.java	2009-02-27 11:58:24 UTC (rev 25463)
@@ -39,21 +39,25 @@
     public boolean activate()
     {
         boolean result = super.activate();
-        // record whether the activation worked
+        
+        // if we cannot activate we want the participant which was registered on behalf of this
+        // coordinator to produce a heuristic result for the transaction. it will do this if it
+        // finds no entry for the coordinate in the subordinate coordinators list. in this case
+        // the subordinate transaction record needs to left as is awaiting manual intervention.
+
         if (result) {
+            // record that the activation worked
             setActivated();
-        }
 
-        int status = status();
-        if (result == false || (status == ActionStatus.PREPARED || status == ActionStatus.COMMITTING)) {
-            // we need to install this coordinator in a global table so that the participant which
-            // was driving it will know that it has been recovered but not yet committed
-            // n.b. we do this even if the activation failed because we need to ensure the
-            // participant rejects a commit until this transaction has committed
-            
-            SubordinateCoordinator.addRecoveredCoordinator(this);
+            int status = status();
+
+            if (status == ActionStatus.PREPARED || status == ActionStatus.COMMITTING) {
+                // we need to install this coordinator in a global table so that the participant which
+                // was driving it will know that it has been recovered but not yet committed
+
+                SubordinateCoordinator.addRecoveredCoordinator(this);
+            }
         }
-
         return result;
     }
 
@@ -74,25 +78,29 @@
 
        if ( _activated )
        {
-           // we don't run phase 2 again if status is PREPARED because we need to wait for the
-           // parent coordinator to tell us what to do
+           // we don't run phase 2 again if status is PREPARED or COMMITTING because we need to wait
+           // for the parent coordinator to tell us what to do. this is true if the coordinator has
+           // been recreated by the first recovery operation after a crash or by a reload from the
+           // log after it was saved in response to a comms tiemout from one of the participants.
+           // In either case the parent transaction should get back to us.
 
-           // we automatically rerun phase2 if the action status is COMMITTING, which happens when
-           // we get a comms timeout from one of the participants after sending it a COMMIT message.
-
-       if ((status == ActionStatus.COMMITTING) ||
+       if ((status == ActionStatus.PREPARED) ||
+               (status == ActionStatus.COMMITTING)||
                (status == ActionStatus.COMMITTED) ||
                (status == ActionStatus.H_COMMIT) ||
                (status == ActionStatus.H_MIXED) ||
                (status == ActionStatus.H_HAZARD))
 	   {
-	       super.phase2Commit( _reportHeuristics ) ;
+	       // ok, we are ready to commit but we wait
+           // for the parent transaction to drive phase2Commit
+           // so do nothing just now
 	   } else if ((status ==  ActionStatus.ABORTED) ||
                (status == ActionStatus.H_ROLLBACK) ||
                (status == ActionStatus.ABORTING) ||
                (status == ActionStatus.ABORT_ONLY))
        {
            super.phase2Abort( _reportHeuristics ) ;
+           SubordinateCoordinator.removeRecoveredCoordinator(this);
        }
 
        if (XTSLogger.arjLoggerI18N.debugAllowed())
@@ -107,11 +115,6 @@
        {
 	   XTSLogger.arjLoggerI18N.warn("org.jboss.jbossts.xts.recovery.coordinator.at.RecoverSubordinateCoordinator_4", new Object[]{get_uid()});
        }
-
-       if ((status == ActionStatus.PREPARED) ||
-               (status == ActionStatus.COMMITTING)) {
-           SubordinateCoordinator.removeRecoveredCoordinator(this);
-       }
    }
 
    // Flag to indicate that this transaction has been re-activated

Modified: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/SubordinateCoordinatorRecoveryModule.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/SubordinateCoordinatorRecoveryModule.java	2009-02-27 11:52:46 UTC (rev 25462)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/SubordinateCoordinatorRecoveryModule.java	2009-02-27 11:58:24 UTC (rev 25463)
@@ -165,8 +165,17 @@
     {
         boolean commitThisTransaction = true ;
 
+        // if the subordinate transaction has already been recovered and has not committed
+        // then we don't create a new one
+
+        if (SubordinateCoordinator.getRecoveredCoordinator(recoverUid.stringForm()) != null) {
+            return;
+        }
+
+        // if there is no entry and there is still a log entry then we need to create a new coordinator
+        
         // Retrieve the transaction status from its original process.
-        // n.b. for a non-active XTS TX this status wil l always be committed even
+        // n.b. for a non-active XTS TX this status will always be committed even
         // if it aborted or had a heuristic outcome. in that case we need to use
         // the logged action status which can only be retrieved after activation
 
@@ -193,7 +202,6 @@
             {
                 XTSLogger.arjLogger.debug( DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
                             FacilityCode.FAC_CRASH_RECOVERY, "jjh doing revovery here for "+recoverUid);
-                // TODO jjh
                 RecoverSubordinateCoordinator rcvSubordinateCoordinator =
                         new RecoverSubordinateCoordinator(recoverUid);
                 rcvSubordinateCoordinator.replayPhase2();

Copied: labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATSubordinateCrashDuringCommit.txt (from rev 25392, labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATCrashDuringCommit.txt)
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATSubordinateCrashDuringCommit.txt	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATSubordinateCrashDuringCommit.txt	2009-02-27 11:58:24 UTC (rev 25463)
@@ -0,0 +1,577 @@
+##############################################################################
+# JBoss, Home of Professional Open Source
+# Copyright 2009, Red Hat Middleware LLC, and individual contributors
+# by the @authors tag. See the copyright.txt in the distribution for a
+# full listing of individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY 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 along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+# @authors Andrew Dinn
+#
+# AT Subordinate Transaction Crash During Commit
+#
+# This script automates testing of a specific recovery scenario for the
+# JBossTS XTS implementation of the WS-AT 1.1 protocol using orchestration
+# rules. The basic scenario employs a coordinator, a subordinate coordinator
+# and 2 web services running in a single JVM. The scenario is as follows
+# (** indicates intercession by a TOAST rule):
+#
+# AS boots
+# Cient starts a WS-AT transaction T1
+# Client invokes web service 1 with register request
+# Web service 1 registers participant P1 in T2
+# Client requests web service 1 to start a subordinate transaction T2
+# Web service 1 creates a subordinate AT transaction
+# Web service 1 registers pseudo-participant PP2 in T1
+# Client invokes web service 1 with subordinate register command
+# Web service 1 resumes T2 and invokes Web Service 2
+# Web service 2 registers participant P2 in T2
+# Client invokes web service 1 with subordinate register command
+# Web service 1 resumes T2 and invokes Web Service 2
+# Web service 2 registers participant P3 in T2
+#
+# Client initiates transaction commit for T1
+#
+# Coordinator initiates prepare of participant P1
+# ** Rule system logs dispatch of prepare to P1
+# ** Rule system logs receipt of prepared from P1
+# Coordinator initiates prepare of subordinate participant PP1
+# ** Rule system logs dispatch of prepare to P1
+# Subordinate coordinator initiates prepare of participant P2
+# ** Rule system logs dispatch of prepare to P1
+# ** Rule system logs receipt of prepared from P1
+# Subordinate coordinator initiates prepare of participant P3
+# ** Rule system logs dispatch of prepare to P1
+# ** Rule system logs receipt of prepared from P1
+# ** Rule system logs receipt of prepared from PP1
+#
+# Coordinator initiates commit of participant P1
+# ** Rule system intercepts commit and crashes JVM
+#
+# AS reboots
+# Recovery system starts after 2 minutes
+# Recovery system recreates PREPARED WS-AT activity coordinator
+# ** Rule system traces create
+# Recovery system recreates participant stub for P1
+# ** Rule system traces create
+# Recovery system recreates participant stub for PP1
+# ** Rule system traces create
+# Recovery system recreates participant stub for P2
+# ** Rule system traces create
+# Recovery system recreates participant stub for P3
+# ** Rule system traces create
+# Recovery system calls replay of PREPARED transaction
+# ** Rule system traces PREPARED replay invocation
+#
+# Coordinator sends commit to P1
+# P1 replies with committed
+# ** Rule system traces receipt of committed
+#
+# Coordinator sends commit to PP1
+#
+# Subordinate coordinator sends commit to P2
+# P2 replies with committed
+# ** Rule system traces receipt of committed
+#
+# Subordinate oordinator sends commit to P3
+# P3 replies with committed
+# ** Rule system traces receipt of committed
+#
+# PP1 replies with committed
+# ** Rule system traces receipt of committed
+#
+# Coordinator clears log record and completes commit
+# ** Rule system detects completed commit and kills JVM
+#
+# Use of this script
+#
+# The default way of exercising this test is to deploy the xtstest war
+# to a single AS and configure it to run the relevant XTS Service Test.
+# The web services and coordinator will be located with the client.
+# The number of participants and subordinate participants can actually be
+# 2, 3 or more. The  web service(s), client (i.e. the XTS Service Test which
+# drives the test) and coordinator and subordinate coordinator service must
+# be colocated for this scritp to work (it is possible to distribute all of
+# these agents if desired but that woud lrequire more complex script rules).
+# The AS should crash when the client commits. At reboot the rest of the test
+# should run automatically and the server should be killed after the recovered
+# transaction is successfuly replayed.
+#
+# This script needs to be passed to a TOAST agent in the JVM running
+# the coordinator service both at first boot and at reboot. Output will be
+# written to file testlog in the working directory of the AS.
+#
+# XTS Service tests which can operate with this scenario can be selected for
+# execution at AS boot by the XTSServiceTestRunnerBean by setting system
+# property
+#    org.jboss.jbossts.xts.servicetests.XTSServiceTestName
+# to the name of a class which will execute the test. This property must
+# be defined in the JVM running the AS to which the xtstest war is deployed
+# i.e. the client AS. n.b. if the client is colocated with the coordinator then
+# this property must be left undefined at AS reboot otherwise the client
+# will run again, starting a new TX which may interfere with recovery of the
+# crashed TX.
+#
+# Available tests include:
+#
+# org.jboss.jbossts.xts.servicetests.test.at.subordinate.MultiParticipantPrepareAndCommitTest
+# this test invokes a service to register a participant and start the suborindate
+# transaction whose location is defined by defining a system property:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL1
+# if this is not set the value used defaults to
+#    http://localhost:8080/xtstest/xtsservicetest1
+# the test forwards a recursive request for registration in the subordinate tarnsaction
+# to a second web service whose location is defined by defining a system property:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL2
+# if this is not set the value used defaults to
+#    http://localhost:8080/xtstest/xtsservicetest2
+#
+# Expected output
+#
+# After the first boot the JVM should exit leaving the following in file testlog
+#
+#   prepare received for participant XXXXXX
+#   prepared sent for participant XXXXXX
+#   prepare received for pseudo participant XXXXXX
+#   prepare received for participant XXXXXX
+#   prepare received for participant XXXXXX
+#   prepared sent for participant XXXXXX
+#   prepared sent for participant XXXXXX
+#   prepared sent for pseudo participant XXXXXX
+#   JVM exit
+#
+# n.b. there should be at least one prepared message received for each participant
+# and in some cases there may be repeat messages
+#
+# After reboot the JVM should exit leaving output in the following format in file
+# testlog.
+#
+#   prepare sent for participant engine XXXXXX
+#   prepare received for participant XXXXXX
+#   prepared sent for participant XXXXXX
+#   prepared received for participant engine XXXXXX
+#   prepare sent for participant engine XXXXXX
+#   prepare received for participant XXXXXX
+#   prepare called for pseudo participant XXXXXX
+#   prepare sent for participant engine XXXXXX
+#   prepare received for participant XXXXXX
+#   prepared sent for participant XXXXXX
+#   prepared received for participant engine XXXXXX
+#   prepare sent for participant engine XXXXXX
+#   prepare received for participant XXXXXX
+#   prepared sent for participant XXXXXX
+#   prepared received for participant engine XXXXXX
+#   prepare completed for pseudo participant XXXXXX
+#   prepare received for participant XXXXXX
+#   JVM exit
+#   created recovered participant engine XXXXXX
+#   created recovered participant engine XXXXXX
+#   created recovered participant engine XXXXXX
+#   created recovered participant engine XXXXXX
+#   created recovered coordinator engine XXXXXX
+#   created recovered coordinator engine XXXXXX
+#   created recovered coordinator engine XXXXXX
+#   created recovered coordinator engine XXXXXX
+#   commit sent for participant engine XXXXXX
+#   commit received for participant XXXXXX
+#   committed sent for participant XXXXXX
+#   committed received for participant engine XXXXXX
+#   commit sent for participant engine XXXXXX
+#   commit received for participant XXXXXX
+#   commit called for pseudo participant XXXXXX
+#   commit sent for participant engine XXXXXX
+#   commit received for participant XXXXXX
+#   committed sent for participant XXXXXX
+#   committed received for participant engine XXXXXX
+#   commit sent for participant engine XXXXXX
+#   commit received for participant XXXXXX
+#   committed sent for participant XXXXXX
+#   committed received for participant engine XXXXXX
+#   commit completed for pseudo participant XXXXXX
+#   committed sent for participant XXXXXX
+#   committed received for participant engine XXXXXX
+#   removed committed transaction XXXXXX
+#   JVM exit
+#
+#######################################################################
+# This rule opens a file for the trace output during XTS startup
+# It will be opened for append at reboot so messages from both runs
+# will go to this file
+#
+RULE open trace file
+CLASS org.jboss.jbossts.XTSService
+METHOD start()
+BIND NOTHING
+IF TRUE
+DO openTrace("log", "testlog")
+ENDRULE
+
+#######################################################################
+## rules for first run of AS
+
+#######################################################################
+# This rule is triggered when a non-recovered coordinator engine
+# (CoordinatorEngine) is sent a commit message. It exits the JVM,
+# simulating a crash. The trigger location is on entry
+
+RULE kill JVM at commit
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD commit
+AT ENTRY
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF (NOT recovered)
+   AND
+   debug("commit on non-recovered coordinator engine " + identifier)
+DO traceln("log", "JVM exit"),
+   debug("!!!killing JVM!!!"),
+   killJVM()
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered coordinator engine
+# (CoordinatorEngine) is requested to send a prepare message. It
+# traces the call.
+
+RULE trace send participant prepare
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD prepare
+AFTER SYNCHRONIZE
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("prepare sent for coordinator engine " + identifier),
+   traceln("log", "prepare sent for coordinator engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered coordinator engine
+# (CoordinatorEngine) receives a prepared message. It traces the call.
+
+RULE trace receive participant prepared
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD prepared(Notification, AddressingProperties, ArjunaContext)
+AT ENTRY
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("prepared received for coordinator engine " + identifier),
+   traceln("log", "prepared received for coordinator engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered participant
+# (ParticipantEngine) receives a prepare message. It
+# traces the call.
+
+RULE trace receive participant prepare
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD prepare
+AFTER SYNCHRONIZE
+BIND engine:ParticipantEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("prepare received for participant " + identifier),
+   traceln("log", "prepare received for participant " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered participant
+# (ParticipantEngine) is requested to send a prepared message. It
+# traces the call.
+
+RULE trace send participant prepared
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD sendPrepared(boolean)
+AT INVOKE sendPrepared
+BIND engine:ParticipantEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("prepared sent for participant " + identifier),
+   traceln("log", "prepared sent for participant " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a subordinate pseudo participant
+# (SubordinateDurable2PCStub) is requested to send a prepared message. It
+# traces the call.
+
+RULE trace subordinate participant stub prepare
+CLASS com.arjuna.wst11.stub.SubordinateDurable2PCStub
+METHOD prepare
+AT ENTRY
+BIND NOTHING
+IF TRUE
+DO debug("prepare called for pseudo-participant " + $0),
+   traceln("log", "prepare called for pseudo-participant " + $0)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a subordinate pseudo participant
+# (SubordinateDurable2PCStub) is requested to send a prepared message. It
+# traces the call.
+
+RULE trace subordinate participant stub prepare
+CLASS com.arjuna.wst11.stub.SubordinateDurable2PCStub
+METHOD prepare
+AFTER INVOKE prepare
+BIND NOTHING
+IF TRUE
+DO debug("prepare completed for pseudo-participant " + $0),
+   traceln("log", "prepare completed for pseudo-participant " + $0)
+ENDRULE
+
+#######################################################################
+## rules for reboot run of AS
+
+#######################################################################
+# This rule is triggered when a coordinator engine (CoordinatorEngine)
+# is created from details located in the log record. It traces the
+# create operation. The trigger location is at entry but the rule
+# should only be triggered after calling the super constructor
+RULE trace coordinator engine create
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD <init>(String, boolean, W3CEndpointReference, boolean, State)
+AT ENTRY
+BIND identifier = $1,
+     recovered=$4
+IF recovered
+DO debug("created recovered coordinator engine " + identifier),
+   traceln("log", "created recovered coordinator engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a participant (ParticipantEngine)
+# is created from details located in the log record. It traces the
+# create operation. The trigger location is at entry but the rule
+# should only be triggered after calling the super constructor
+
+RULE trace participant create
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD <init>(Participant, String, State, W3CEndpointReference, boolean)
+AT ENTRY
+BIND identifier = $2,
+     recovered=$5
+IF recovered
+DO debug("created recovered participant engine " + identifier),
+   traceln("log", "created recovered participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered coordinator engine
+# (CoordinatorEngine) is requested to send a commit message. This
+# happens during replay of a prepared TX from
+# the log. It traces the call.
+
+RULE trace send recovered participant commit
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD commit
+AFTER SYNCHRONIZE
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("send commit for recovered coordinator engine " + identifier),
+   traceln("log", "send commit for recovered coordinator engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered coordinator engine
+# (CoordinatorEngine) receives a committed message. This
+# happens during replay of a prepared TX from
+# the log. It traces the call.
+
+RULE trace receive recovered participant committed
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD committed
+AFTER SYNCHRONIZE
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("received committed for recovered coordinator engine " + identifier),
+   traceln("log", "received committed for recovered coordinator engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered participant engine
+# (ParticipantEngine) is requested to send a committed message. This
+# happens during replay of a prepared TX from
+# the log. It traces the call.
+
+RULE trace send recovered participant committed
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD sendCommitted
+AFTER INVOKE sendCommitted
+BIND engine:ParticipantEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("send committed for recovered participant engine " + identifier),
+   traceln("log", "send committed for recovered participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered coordinator engine
+# (ParticipantEngine) receives a commit message. This
+# happens during replay of a prepared TX from
+# the log. It traces the call.
+
+RULE trace receive recovered participant commit
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD commit
+AFTER SYNCHRONIZE
+BIND engine:ParticipantEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("received commit for recovered participant engine " + identifier),
+   traceln("log", "received commit for recovered participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a subordinate pseudo participant
+# (SubordinateDurable2PCStub) is requested to send a commit message. It
+# traces the call.
+
+RULE trace subordinate participant stub commit
+CLASS com.arjuna.wst11.stub.SubordinateDurable2PCStub
+METHOD commit
+AT ENTRY
+BIND NOTHING
+IF TRUE
+DO debug("commit called for pseudo-participant " + $0),
+   traceln("log", "commit called for pseudo-participant " + $0)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a subordinate pseudo participant
+# (SubordinateDurable2PCStub) forwards a commit message to its subordinate
+# coordinator during recovery. It traces the call.
+
+RULE trace subordinate participant stub commit forward
+CLASS com.arjuna.wst11.stub.SubordinateDurable2PCStub
+METHOD commit
+AT INVOKE commit 2
+BIND NOTHING
+IF TRUE
+DO debug("forwarding commit for pseudo-participant " + $0 + " to subordinate coordinator"),
+   traceln("log", "forwarding commit for pseudo-participant " + $0 + " to subordinate coordinator")
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a subordinate pseudo participant
+# (SubordinateDurable2PCStub) throws an error from its commit method
+# because the subordinate coordinator has not yet been recovered. It
+# traces the throw.
+
+RULE trace subordinate participant stub commit with no coordinator
+CLASS com.arjuna.wst11.stub.SubordinateDurable2PCStub
+METHOD commit
+AT THROW
+BIND NOTHING
+IF TRUE
+DO debug("throw during commit for pseudo-participant " + $0 + " with no subordinate coordinator"),
+   traceln("log", "throw during commit for pseudo-participant " + $0 + " with no subordinate coordinator")
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a subordinate pseudo participant
+# (SubordinateDurable2PCStub) throws an error from its commit method
+# because the subordinate coordinator has not yet been activated. It
+# traces the throw.
+
+
+RULE trace subordinate participant stub commit commit with unactivated coordinator
+CLASS com.arjuna.wst11.stub.SubordinateDurable2PCStub
+METHOD commit
+AT THROW 2
+BIND NOTHING
+IF TRUE
+DO debug("throw during commit for pseudo-participant " + $0 + " with unactivated subordinate coordinator"),
+   traceln("log", "throw during commit for pseudo-participant " + $0 + " with unactivated subordinate coordinator")
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a subordinate pseudo participant
+# (SubordinateDurable2PCStub) returns from sending a commit message. It
+# traces the call.
+
+RULE trace subordinate participant stub prepare
+CLASS com.arjuna.wst11.stub.SubordinateDurable2PCStub
+METHOD commit
+AFTER INVOKE commit 2
+BIND NOTHING
+IF TRUE
+DO debug("commit completed for pseudo-participant " + $0),
+   traceln("log", "commit completed for pseudo-participant " + $0)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a subordinate coordinator
+# (SubordinateCoordinator) is requested to perform a commit. It
+# traces the call.
+
+RULE trace subordinate coordinator commit
+CLASS com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateCoordinator
+METHOD commit
+AT ENTRY
+BIND NOTHING
+IF TRUE
+DO debug("commit called for subordinate coordinator " + $0),
+   traceln("log", "commit called for subordinate coordinator " + $0)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when the recovery system finds a PREPARED
+# activity in the log and reruns the phase 2 commit operation.
+# It prints a message which can be used to verify that the test has
+# progressed as expected.
+
+RULE trace prepared replay
+CLASS org.jboss.jbossts.xts.recovery.coordinator.ba.RecoverACCoordinator
+METHOD replayPhase2
+AT INVOKE phase2Commit
+BIND coordinator = $0,
+     uid : Uid = coordinator.identifier(),
+     status : int = coordinator.status()
+IF (status == com.arjuna.ats.arjuna.coordinator.ActionStatus.PREPARED)
+     OR
+     (status == com.arjuna.ats.arjuna.coordinator.ActionStatus.COMMITTING)
+DO debug("replaying close for prepared transaction " + uid),
+   traceln("log", "replaying commit for prepared transaction " + uid)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when the recovery system deletes the COMMITTED
+# activity from the log. It prints a message which can be used to
+# verify that the test has completed.
+
+RULE trace remove committed state
+CLASS com.arjuna.ats.arjuna.coordinator.BasicAction
+METHOD updateState
+AFTER CALL remove_committed
+BIND action : BasicAction = $0,
+     uid  = action.get_uid()
+IF TRUE
+DO traceln("log", "removed committed transaction " + uid),
+   debug("removed committed transaction " + uid)
+ENDRULE

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java	2009-02-27 11:52:46 UTC (rev 25462)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java	2009-02-27 11:58:24 UTC (rev 25463)
@@ -292,8 +292,8 @@
             }
 
             try {
-                UserTransaction userTransaction = UserTransactionFactory.userTransaction();
-                userTransaction.beginSubordinate();
+                UserTransaction userTransaction = UserTransactionFactory.userSubordinateTransaction();
+                userTransaction.begin();
                 newTx = TransactionManager.getTransactionManager().currentTransaction();
             } catch (Exception e) {
                 throw new WebServiceException("subtransaction begin() failed with exception " + e);




More information about the jboss-svn-commits mailing list