[jboss-svn-commits] JBL Code SVN: r25245 - in labs/jbosstm/trunk/XTS/WS-T/dev: src10/com/arjuna/wst/messaging and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Feb 12 12:16:21 EST 2009


Author: adinn
Date: 2009-02-12 12:16:21 -0500 (Thu, 12 Feb 2009)
New Revision: 25245

Modified:
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/CoordinatorCompletionCoordinatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/CoordinatorCompletionParticipantClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/ParticipantCompletionCoordinatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/ParticipantCompletionParticipantClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/CoordinatorCompletionParticipantProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/ParticipantCompletionCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/ParticipantCompletionParticipantProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/engines/CoordinatorCompletionParticipantEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/engines/ParticipantCompletionParticipantEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionParticipantProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionParticipantProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java
Log:
Added mode switch to participants so that they switch from sending
Completed to sending GetStatus once the resend period has reached the
maximum limit and at least one Completed message has been sent. The
switch is deactivated and the period restored to the initial value if
a message comes in from the coordinator (e.g. a Status or a resent
Complete). The switch is also automatically set to send getStatus when
a recovered participant is activated.

Fixed GetStatus methods for coordinator and participant processors so
they send an InvalidState soap fault when a GetStatus is received for
an unknown participant/participant stub.

Modified participant soap fault handling so that an InvalidState soap
fault received while checking the participant status causes an
automatic compensate of the participant (this is presumed abort since
the coordinator does not know that the participant exists). Any other
fault is handled by calling the participant error method. In either
case any record of the participant in the transaction log is deleted.

This implements all the missing recovery functionality required to fix
JBTM-488.


Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/CoordinatorCompletionCoordinatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/CoordinatorCompletionCoordinatorClient.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/CoordinatorCompletionCoordinatorClient.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -26,6 +26,7 @@
 import com.arjuna.webservices.SoapFault;
 import com.arjuna.webservices.SoapRegistry;
 import com.arjuna.webservices.SoapService;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.base.policy.ClientPolicy;
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsaddr.AttributedURIType;
@@ -56,7 +57,7 @@
     private final AttributedURIType completedAction =
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_COMPLETED) ;
     /**
-     * The fault action.
+     * The BA fault action.
      */
     private final AttributedURIType faultAction =
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_FAULT) ;
@@ -92,6 +93,12 @@
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_STATUS) ;
     
     /**
+     * The SOAP fault action.
+     */
+    private final AttributedURIType soapFaultAction =
+        new AttributedURIType(CoordinationConstants.WSCOOR_ACTION_FAULT) ;
+
+    /**
      * The SOAP service representing the client.
      */
     private final SoapService soapService ;
@@ -248,6 +255,21 @@
     }
     
     /**
+     * Send a fault.
+     * @param addressingContext The addressing context.
+     * @param soapFault The SOAP fault.
+     * @param identifier The arjuna instance identifier.
+     * @throws SoapFault For any errors.
+     * @throws IOException for any transport errors.
+     */
+    public void sendSoapFault(final AddressingContext addressingContext, final SoapFault soapFault, final InstanceIdentifier identifier)
+        throws SoapFault, IOException
+    {
+        final EndpointReferenceType endpointReference = getEndpointReference(identifier) ;
+        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, soapFaultAction) ;
+    }
+
+    /**
      * Get the endpoint reference for the specified identifier.
      * @param identifier The endpoint reference identifier.
      * @return The endpoint reference.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/CoordinatorCompletionParticipantClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/CoordinatorCompletionParticipantClient.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/CoordinatorCompletionParticipantClient.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -26,6 +26,7 @@
 import com.arjuna.webservices.SoapFault;
 import com.arjuna.webservices.SoapRegistry;
 import com.arjuna.webservices.SoapService;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.base.policy.ClientPolicy;
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsaddr.AttributedURIType;
@@ -91,6 +92,12 @@
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_STATUS) ;
     
     /**
+     * The SOAP fault action.
+     */
+    private final AttributedURIType soapFaultAction =
+        new AttributedURIType(CoordinationConstants.WSCOOR_ACTION_FAULT) ;
+
+    /**
      * The SOAP service representing the client.
      */
     private final SoapService soapService ;
@@ -98,7 +105,7 @@
      * The coordinator completion coordinator URI for replies.
      */
     private final AttributedURIType coordinatorCompletionCoordinator ;
-    
+
     /**
      * Construct the participant completion coordinator client.
      */
@@ -245,6 +252,21 @@
     }
     
     /**
+     * Send a fault.
+     * @param addressingContext The addressing context.
+     * @param soapFault The SOAP fault.
+     * @param identifier The arjuna instance identifier.
+     * @throws SoapFault For any errors.
+     * @throws IOException for any transport errors.
+     */
+    public void sendSoapFault(final AddressingContext addressingContext, final SoapFault soapFault, final InstanceIdentifier identifier)
+        throws SoapFault, IOException
+    {
+        final EndpointReferenceType endpointReference = getEndpointReference(identifier) ;
+        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, soapFaultAction) ;
+    }
+
+    /**
      * Get the endpoint reference for the specified identifier.
      * @param identifier The endpoint reference identifier.
      * @return The endpoint reference.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/ParticipantCompletionCoordinatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/ParticipantCompletionCoordinatorClient.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/ParticipantCompletionCoordinatorClient.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -26,6 +26,7 @@
 import com.arjuna.webservices.SoapFault;
 import com.arjuna.webservices.SoapRegistry;
 import com.arjuna.webservices.SoapService;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.base.policy.ClientPolicy;
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsaddr.AttributedURIType;
@@ -56,7 +57,7 @@
     private final AttributedURIType completedAction =
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_COMPLETED) ;
     /**
-     * The fault action.
+     * The BA fault action.
      */
     private final AttributedURIType faultAction =
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_FAULT) ;
@@ -92,6 +93,12 @@
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_STATUS) ;
     
     /**
+     * The SOAP fault action.
+     */
+    private final AttributedURIType soapFaultAction =
+        new AttributedURIType(CoordinationConstants.WSCOOR_ACTION_FAULT) ;
+
+    /**
      * The SOAP service representing the client.
      */
     private final SoapService soapService ;
@@ -247,6 +254,21 @@
     }
     
     /**
+     * Send a fault.
+     * @param addressingContext The addressing context.
+     * @param soapFault The SOAP fault.
+     * @param identifier The arjuna instance identifier.
+     * @throws SoapFault For any errors.
+     * @throws IOException for any transport errors.
+     */
+    public void sendSoapFault(final AddressingContext addressingContext, final SoapFault soapFault, final InstanceIdentifier identifier)
+        throws SoapFault, IOException
+    {
+        final EndpointReferenceType endpointReference = getEndpointReference(identifier) ;
+        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, soapFaultAction) ;
+    }
+
+    /**
      * Get the endpoint reference for the specified identifier.
      * @param identifier The endpoint reference identifier.
      * @return The endpoint reference.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/ParticipantCompletionParticipantClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/ParticipantCompletionParticipantClient.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/webservices/wsba/client/ParticipantCompletionParticipantClient.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -26,6 +26,7 @@
 import com.arjuna.webservices.SoapFault;
 import com.arjuna.webservices.SoapRegistry;
 import com.arjuna.webservices.SoapService;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.base.policy.ClientPolicy;
 import com.arjuna.webservices.wsaddr.AddressingContext;
 import com.arjuna.webservices.wsaddr.AttributedURIType;
@@ -86,6 +87,12 @@
         new AttributedURIType(BusinessActivityConstants.WSBA_ACTION_STATUS) ;
     
     /**
+     * The SOAP fault action.
+     */
+    private final AttributedURIType soapFaultAction =
+        new AttributedURIType(CoordinationConstants.WSCOOR_ACTION_FAULT) ;
+
+    /**
      * The SOAP service representing the client.
      */
     private final SoapService soapService ;
@@ -93,7 +100,7 @@
      * The participant completion coordinator URI for replies.
      */
     private final AttributedURIType participantCompletionCoordinator ;
-    
+
     /**
      * Construct the participant completion coordinator client.
      */
@@ -224,6 +231,21 @@
     }
     
     /**
+     * Send a fault.
+     * @param addressingContext The addressing context.
+     * @param soapFault The SOAP fault.
+     * @param identifier The arjuna instance identifier.
+     * @throws SoapFault For any errors.
+     * @throws IOException for any transport errors.
+     */
+    public void sendSoapFault(final AddressingContext addressingContext, final SoapFault soapFault, final InstanceIdentifier identifier)
+        throws SoapFault, IOException
+    {
+        final EndpointReferenceType endpointReference = getEndpointReference(identifier) ;
+        sendSoapFault(soapFault, addressingContext, soapService, endpointReference, soapFaultAction) ;
+    }
+
+    /**
      * Get the endpoint reference for the specified identifier.
      * @param identifier The endpoint reference identifier.
      * @return The endpoint reference.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -21,9 +21,14 @@
 package com.arjuna.wst.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFault10;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsaddr.AttributedURIType;
+import com.arjuna.webservices.wsaddr.RelationshipType;
 import com.arjuna.webservices.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
 import com.arjuna.webservices.wsba.CoordinatorCompletionCoordinatorInboundEvents;
@@ -35,7 +40,11 @@
 import com.arjuna.wsc.messaging.MessageId;
 import org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager;
 
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.AddressingBuilder;
+import java.net.URISyntaxException;
 
+
 /**
  * The Coordinator Completion Coordinator processor.
  * @author kevin
@@ -323,6 +332,8 @@
      * 
      * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_1 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
      * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2] - GetStatus called on unknown coordinator: {0}
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_3 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_3] - Unexpected exception while sending InvalidStateFault to participant {0}
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_4 [com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_4] - GetStatus requested for unknown coordinator completion participant
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
@@ -343,12 +354,56 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            }
+            // send an invalid state fault
+
+            final String responseMessageId = MessageId.getMessageId() ;
+            final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), responseMessageId) ;
+
+            final AttributedURIType requestMessageId = addressingContext.getMessageID() ;
+            if (requestMessageId != null)
+            {
+                responseAddressingContext.addRelatesTo(new RelationshipType(requestMessageId.getValue())) ;
+            }
+            final String messageId = MessageId.getMessageId();
+            final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
+            try
+            {
+                final String message = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_4") ;
+                final SoapFault soapFault = new SoapFault10(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, message) ;
+                CoordinatorCompletionParticipantClient.getClient().sendSoapFault(responseAddressingContext, soapFault, instanceIdentifier) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isInfoEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.info("com.arjuna.wst.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_3", new Object[] {instanceIdentifier},  th) ;
+                }
+            }
         }
     }
-    
+
+    private static AttributedURI faultAction = null;
+
+    private static synchronized AttributedURI getFaultAction()
+    {
+        if (faultAction == null) {
+            AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+
+            try {
+                faultAction = builder.newURI(CoordinationConstants.WSCOOR_ACTION_FAULT);
+            } catch (URISyntaxException e) {
+                // TODO log error here
+            }
+        }
+
+        return faultAction;
+    }
     /**
      * Status.
      * @param status The status.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/CoordinatorCompletionParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/CoordinatorCompletionParticipantProcessorImpl.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/CoordinatorCompletionParticipantProcessorImpl.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -21,9 +21,14 @@
 package com.arjuna.wst.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFault10;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsaddr.AttributedURIType;
+import com.arjuna.webservices.wsaddr.RelationshipType;
 import com.arjuna.webservices.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
 import com.arjuna.webservices.wsba.CoordinatorCompletionParticipantInboundEvents;
@@ -313,6 +318,8 @@
      * 
      * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_1 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
      * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2] - GetStatus called on unknown participant: {0}
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_3 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_3] - Unexpected exception while sending InvalidStateFault to coordinator for participant {0}
+     * @message com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_4 [com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_4] - GetStatus requested for unknown coordinator completion participant
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
@@ -333,10 +340,38 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
+        if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
             WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
         }
+            // send an invalid state fault
+
+            final String responseMessageId = MessageId.getMessageId() ;
+            final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), responseMessageId) ;
+
+            final AttributedURIType requestMessageId = addressingContext.getMessageID() ;
+            if (requestMessageId != null)
+            {
+                responseAddressingContext.addRelatesTo(new RelationshipType(requestMessageId.getValue())) ;
+            }
+            final String messageId = MessageId.getMessageId();
+            final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
+            try
+            {
+                final String message = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_4") ;
+                final SoapFault soapFault = new SoapFault10(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, message) ;
+                CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(responseAddressingContext, soapFault, instanceIdentifier) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isInfoEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.info("com.arjuna.wst.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_3", new Object[] {instanceIdentifier},  th) ;
+                }
+            }
+        }
     }
     
     /**

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/ParticipantCompletionCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/ParticipantCompletionCoordinatorProcessorImpl.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/ParticipantCompletionCoordinatorProcessorImpl.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -21,9 +21,14 @@
 package com.arjuna.wst.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFault10;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsaddr.AttributedURIType;
+import com.arjuna.webservices.wsaddr.RelationshipType;
 import com.arjuna.webservices.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
 import com.arjuna.webservices.wsba.ExceptionType;
@@ -324,6 +329,8 @@
      * 
      * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_1 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
      * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2] - GetStatus called on unknown coordinator: {0}
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_3 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_3] - Unexpected exception while sending InvalidStateFault to participant {0}
+     * @message com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_4 [com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_4] - GetStatus requested for unknown coordinator completion participant
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
@@ -344,9 +351,37 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            }
+            // send an invalid state fault
+
+            final String responseMessageId = MessageId.getMessageId() ;
+            final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), responseMessageId) ;
+
+            final AttributedURIType requestMessageId = addressingContext.getMessageID() ;
+            if (requestMessageId != null)
+            {
+                responseAddressingContext.addRelatesTo(new RelationshipType(requestMessageId.getValue())) ;
+            }
+            final String messageId = MessageId.getMessageId();
+            final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
+            try
+            {
+                final String message = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_4") ;
+                final SoapFault soapFault = new SoapFault10(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, message) ;
+                ParticipantCompletionParticipantClient.getClient().sendSoapFault(responseAddressingContext, soapFault, instanceIdentifier) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isInfoEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.info("com.arjuna.wst.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_3", new Object[] {instanceIdentifier},  th) ;
+                }
+            }
         }
     }
     

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/ParticipantCompletionParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/ParticipantCompletionParticipantProcessorImpl.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/ParticipantCompletionParticipantProcessorImpl.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -21,9 +21,14 @@
 package com.arjuna.wst.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFault10;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.wsaddr.AddressingContext;
+import com.arjuna.webservices.wsaddr.AttributedURIType;
+import com.arjuna.webservices.wsaddr.RelationshipType;
 import com.arjuna.webservices.wsarj.ArjunaContext;
 import com.arjuna.webservices.wsarj.InstanceIdentifier;
 import com.arjuna.webservices.wsba.NotificationType;
@@ -274,6 +279,8 @@
      * 
      * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_1 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
      * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2] - Complete called on unknown participant: {0}
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_3 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_3] - Unexpected exception while sending InvalidStateFault to coordinator for participant {0}
+     * @message com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_4 [com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_4] - GetStatus requested for unknown coordinator completion participant
      */
     public void getStatus(final NotificationType getStatus, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
@@ -294,9 +301,37 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            }
+            // send an invalid state fault
+
+            final String responseMessageId = MessageId.getMessageId() ;
+            final AddressingContext responseAddressingContext = AddressingContext.createRequestContext(addressingContext.getFrom(), responseMessageId) ;
+
+            final AttributedURIType requestMessageId = addressingContext.getMessageID() ;
+            if (requestMessageId != null)
+            {
+                responseAddressingContext.addRelatesTo(new RelationshipType(requestMessageId.getValue())) ;
+            }
+            final String messageId = MessageId.getMessageId();
+            final AddressingContext faultAddressingContext = AddressingContext.createFaultContext(addressingContext, messageId) ;
+            try
+            {
+                final String message = WSTLogger.log_mesg.getString("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_4") ;
+                final SoapFault soapFault = new SoapFault10(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, message) ;
+                ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(responseAddressingContext, soapFault, instanceIdentifier) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isInfoEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.info("com.arjuna.wst.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_3", new Object[] {instanceIdentifier},  th) ;
+                }
+            }
         }
     }
     

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/engines/CoordinatorCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/engines/CoordinatorCompletionParticipantEngine.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/engines/CoordinatorCompletionParticipantEngine.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -24,6 +24,7 @@
 
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices.wsaddr.AddressingContext;
@@ -108,6 +109,11 @@
     private boolean persisted;
 
     /**
+     * true if the participant should send getstatus rather than resend a completed message
+     */
+    private boolean checkStatus;
+
+    /**
      * Construct the initial engine for the participant.
      * @param id The participant id.
      * @param coordinator The coordinator endpoint reference.
@@ -140,6 +146,9 @@
         this.maxResendPeriod = TransportTimer.getMaximumTransportPeriod();
         this.timeout = TransportTimer.getTransportTimeout();
         this.resendPeriod = this.initialResendPeriod;
+        // we always check the status of a recovered participant and we always start off sending completed
+        // if the participant is not recovered
+        this.checkStatus = recovered;
     }
     
     /**
@@ -461,7 +470,11 @@
      */
     public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        // KEV - implement
+        // TODO --  check that the status is actually what we expect
+
+        // revert to sending completed messages and reset the resend period to the initial period
+        checkStatus = false;
+        updateResendPeriod(false);
     }
     
     /**
@@ -488,7 +501,7 @@
 
         if (current == State.STATE_COMPLETED)
         {
-            sendCompleted();
+            sendCompleted(true);
         }
     }
 
@@ -498,18 +511,39 @@
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_1 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_1] - Unable to delete recovery record during soapFault processing for WS-BA participant {0}
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_2 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_2] - Cancelling participant {0}
+     * @message com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_3 [com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_3] - Notifying unexpected error for participant {0}
      */
     public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         boolean deleteRequired;
+        boolean checkingStatus;
         synchronized(this) {
             deleteRequired = persisted;
+            // make sure delete is attempted only once
+            persisted = false;
+            checkingStatus = (state == State.STATE_COMPLETED && checkStatus);
             ended() ;
         }
-        // TODO -- clarify when and why this gets called and update doc in interface. also check unknown()
+        // TODO -- update doc in interface and user guide.
         try
         {
-            participant.error() ;
+            boolean isInvalidState = soapFault.getSubcode().equals(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME);
+            if (checkingStatus && isInvalidState) {
+                // coordinator must have died before reaching close so just cancel
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_2", new Object[] {id}) ;
+                }
+                participant.compensate();
+            } else {
+                // hmm, something went wrong -- notify the participant of the error
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_3", new Object[] {id}) ;
+                }
+                participant.error() ;
+            }
         }
         catch (final Throwable th) {} // ignore
         // if we just ended the participant ensure any log record gets deleted

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/engines/ParticipantCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/engines/ParticipantCompletionParticipantEngine.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src10/com/arjuna/wst/messaging/engines/ParticipantCompletionParticipantEngine.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -23,6 +23,7 @@
 import java.util.TimerTask;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wscoor.CoordinationConstants;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices.wsaddr.AddressingContext;
@@ -107,6 +108,11 @@
     private boolean persisted;
 
     /**
+     * true if the participant should send getstatus rather than resend a completed message
+     */
+    private boolean checkStatus;
+
+    /**
      * Construct the initial engine for the participant.
      * @param id The participant id.
      * @param coordinator The coordinator endpoint reference.
@@ -139,6 +145,9 @@
         this.maxResendPeriod = TransportTimer.getMaximumTransportPeriod();
         this.timeout = TransportTimer.getTransportTimeout();
         this.resendPeriod = this.initialResendPeriod;
+        // we always check the status of a recovered participant and we always start off sending completed
+        // if the participant is not recovered
+        this.checkStatus = recovered;
     }
     
     /**
@@ -399,7 +408,11 @@
      */
     public void status(final StatusType status, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
-        // KEV - implement
+        // TODO --  check that the status is actually what we expect
+
+        // revert to sending completed messages and reset the resend period to the initial period
+        checkStatus = false;
+        updateResendPeriod(false);
     }
     
     /**
@@ -426,7 +439,7 @@
 
         if (current == State.STATE_COMPLETED)
         {
-            sendCompleted();
+            sendCompleted(true);
         }
     }
 
@@ -436,18 +449,39 @@
      * @param addressingContext The addressing context.
      * @param arjunaContext The arjuna context.
      * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_1 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_1] - Unable to delete recovery record during soapFault processing for WS-BA participant {0}
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_2 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_2] - Cancelling participant {0}
+     * @message com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_3 [com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_3] - Notifying unexpected error for participant {0}
      */
     public void soapFault(final SoapFault soapFault, final AddressingContext addressingContext, final ArjunaContext arjunaContext)
     {
         boolean deleteRequired;
+        boolean checkingStatus;
         synchronized(this) {
             deleteRequired = persisted;
+            // make sure delete is attempted only once
+            persisted = false;
+            checkingStatus = (state == State.STATE_COMPLETED && checkStatus);
             ended() ;
         }
-        // TODO -- clarify when and why this gets called and update doc in interface. also check unknown()
+        // TODO -- update doc in interface and user guide.
         try
         {
-            participant.error() ;
+            boolean isInvalidState = soapFault.getSubcode().equals(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME);
+            if (checkingStatus && isInvalidState) {
+                // coordinator must have died before reaching close so just cancel
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_2", new Object[] {id}) ;
+                }
+                participant.compensate();
+            } else {
+                // hmm, something went wrong -- notify the participant of the error
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_3", new Object[] {id}) ;
+                }
+                participant.error() ;
+            }
         }
         catch (final Throwable th) {} // ignore
         // if we just ended the participant ensure any log record gets deleted

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -21,9 +21,11 @@
 package com.arjuna.wst11.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.CoordinatorCompletionCoordinatorInboundEvents;
@@ -31,6 +33,8 @@
 import com.arjuna.webservices11.wsba.client.CoordinatorCompletionParticipantClient;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
 import com.arjuna.wsc11.messaging.MessageId;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
@@ -38,6 +42,9 @@
 import org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager;
 
 import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.AddressingBuilder;
+import java.net.URISyntaxException;
 
 
 /**
@@ -363,6 +370,8 @@
      *
      * @message com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_1 [com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
      * @message com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2 [com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2] - GetStatus called on unknown coordinator: {0}
+     * @message com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_3 [com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_3] - Unexpected exception while sending InvalidStateFault to participant {0}
+     * @message com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_4 [com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_4] - GetStatus requested for unknown coordinator completion participant
      */
     public void getStatus(final NotificationType getStatus, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
     {
@@ -383,12 +392,50 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            }
+            // send an invalid state fault
+
+            final String messageId = MessageId.getMessageId();
+            final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
+            try
+            {
+                final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME,
+                        WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_4")) ;
+                AddressingHelper.installNoneReplyTo(faultAddressingProperties);
+                SoapFaultClient.sendSoapFault(soapFault, faultAddressingProperties, getFaultAction()) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isInfoEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.info("com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.getStatus_3", new Object[] {instanceIdentifier},  th) ;
+                }
+            }
         }
     }
 
+    private static AttributedURI faultAction = null;
+
+    private static synchronized AttributedURI getFaultAction()
+    {
+        if (faultAction == null) {
+            AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+
+            try {
+                faultAction = builder.newURI(CoordinationConstants.WSCOOR_ACTION_FAULT);
+            } catch (URISyntaxException e) {
+                // TODO log error here
+            }
+        }
+
+        return faultAction;
+    }
+
     /**
      * Status.
      * @param status The status.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionParticipantProcessorImpl.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionParticipantProcessorImpl.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -21,9 +21,11 @@
 package com.arjuna.wst11.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents;
@@ -32,13 +34,18 @@
 import com.arjuna.webservices11.wsba.client.CoordinatorCompletionCoordinatorClient;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionParticipantProcessor;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
 import com.arjuna.wsc11.messaging.MessageId;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
 import org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager;
 
 import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.AddressingBuilder;
 import javax.xml.namespace.QName;
+import java.net.URISyntaxException;
 
 
 /**
@@ -456,6 +463,8 @@
      *
      * @message com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_1 [com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
      * @message com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2 [com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2] - GetStatus called on unknown participant: {0}
+     * @message com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_3 [com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_3] - Unexpected exception while sending InvalidStateFault to coordinator for participant {0}
+     * @message com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_4 [com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_4] - GetStatus requested for unknown coordinator completion participant
      */
     public void getStatus(final NotificationType getStatus, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
     {
@@ -476,12 +485,50 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            }
+            // send an invalid state fault
+
+            final String messageId = MessageId.getMessageId();
+            final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
+            try
+            {
+                final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME,
+                        WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_4")) ;
+                AddressingHelper.installNoneReplyTo(faultAddressingProperties);
+                SoapFaultClient.sendSoapFault(soapFault, faultAddressingProperties, getFaultAction()) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isInfoEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.info("com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.getStatus_3", new Object[] {instanceIdentifier},  th) ;
+                }
+            }
         }
     }
 
+    private static AttributedURI faultAction = null;
+
+    private static synchronized AttributedURI getFaultAction()
+    {
+        if (faultAction == null) {
+            AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+
+            try {
+                faultAction = builder.newURI(CoordinationConstants.WSCOOR_ACTION_FAULT);
+            } catch (URISyntaxException e) {
+                // TODO log error here
+            }
+        }
+
+        return faultAction;
+    }
+
     /**
      * Status.
      * @param status The status.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionCoordinatorProcessorImpl.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionCoordinatorProcessorImpl.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -21,14 +21,18 @@
 package com.arjuna.wst11.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents;
 import com.arjuna.webservices11.wsba.client.ParticipantCompletionParticipantClient;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionCoordinatorProcessor;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
 import com.arjuna.wsc11.messaging.MessageId;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
@@ -36,6 +40,9 @@
 import org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager;
 
 import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.AddressingBuilder;
+import java.net.URISyntaxException;
 
 
 /**
@@ -359,6 +366,8 @@
      *
      * @message com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_1 [com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
      * @message com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2 [com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2] - GetStatus called on unknown coordinator: {0}
+     * @message com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_3 [com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_3] - Unexpected exception while sending InvalidStateFault to participant {0}
+     * @message com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_4 [com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_4] - GetStatus requested for unknown participant completion participant
      */
     public void getStatus(final NotificationType getStatus, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
     {
@@ -379,12 +388,51 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            }
+            
+            // send an invalid state fault
+
+            final String messageId = MessageId.getMessageId();
+            final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
+            try
+            {
+                final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME,
+                        WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_4")) ;
+                AddressingHelper.installNoneReplyTo(faultAddressingProperties);
+                SoapFaultClient.sendSoapFault(soapFault, faultAddressingProperties, getFaultAction()) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isInfoEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.info("com.arjuna.wst11.messaging.ParticipantCompletionCoordinatorProcessorImpl.getStatus_3", new Object[] {instanceIdentifier},  th) ;
+                }
+            }
         }
     }
 
+    private static AttributedURI faultAction = null;
+
+    private static synchronized AttributedURI getFaultAction()
+    {
+        if (faultAction == null) {
+            AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+
+            try {
+                faultAction = builder.newURI(CoordinationConstants.WSCOOR_ACTION_FAULT);
+            } catch (URISyntaxException e) {
+                // TODO log error here
+            }
+        }
+
+        return faultAction;
+    }
+
     /**
      * Status.
      * @param status The status.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionParticipantProcessorImpl.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionParticipantProcessorImpl.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -21,9 +21,11 @@
 package com.arjuna.wst11.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents;
@@ -31,12 +33,17 @@
 import com.arjuna.webservices11.wsba.client.ParticipantCompletionCoordinatorClient;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionParticipantProcessor;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
 import com.arjuna.wsc11.messaging.MessageId;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
 import org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager;
 
 import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.AddressingBuilder;
+import java.net.URISyntaxException;
 
 
 /**
@@ -415,6 +422,8 @@
      *
      * @message com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_1 [com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_1] - Unexpected exception thrown from getStatus:
      * @message com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2 [com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2] - GetStatus called on unknown participant: {0}
+     * @message com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_3 [com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_3] - Unexpected exception while sending InvalidStateFault to coordinator for participant {0}
+     * @message com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_4 [com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_4] - GetStatus requested for unknown participant completion participant
      */
     public void getStatus(final NotificationType getStatus, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
     {
@@ -435,12 +444,49 @@
                 }
             }
         }
-        else if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        else
         {
-            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_2", new Object[] {instanceIdentifier}) ;
+            }
+            // send an invalid state fault
+
+            final String messageId = MessageId.getMessageId();
+            final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
+            try
+            {
+                final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME,
+                        WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_4")) ;
+                AddressingHelper.installNoneReplyTo(faultAddressingProperties);
+                SoapFaultClient.sendSoapFault(soapFault, faultAddressingProperties, getFaultAction()) ;
+            }
+            catch (final Throwable th)
+            {
+                if (WSTLogger.arjLoggerI18N.isInfoEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.info("com.arjuna.wst11.messaging.ParticipantCompletionParticipantProcessorImpl.getStatus_3", new Object[] {instanceIdentifier},  th) ;
+                }
+            }
         }
     }
 
+    private static AttributedURI faultAction = null;
+
+    private static synchronized AttributedURI getFaultAction()
+    {
+        if (faultAction == null) {
+            AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+
+            try {
+                faultAction = builder.newURI(CoordinationConstants.WSCOOR_ACTION_FAULT);
+            } catch (URISyntaxException e) {
+                // TODO log error here
+            }
+        }
+
+        return faultAction;
+    }
     /**
      * Status.
      * @param status The status type.

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -31,6 +31,7 @@
 import com.arjuna.webservices11.wsba.BusinessActivityConstants;
 import com.arjuna.webservices11.wsba.client.CoordinatorCompletionCoordinatorClient;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionParticipantProcessor;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
 import com.arjuna.wst.FaultedException;
@@ -109,6 +110,10 @@
      */
     private boolean persisted;
 
+    /**
+     * true if the participant should send getstatus rather than resend a completed message
+     */
+    private boolean checkStatus;
 
     /**
      * Construct the initial engine for the participant.
@@ -144,6 +149,9 @@
         this.maxResendPeriod = TransportTimer.getMaximumTransportPeriod();
         this.timeout = TransportTimer.getTransportTimeout();
         this.resendPeriod = this.initialResendPeriod;
+        // we always check the status of a recovered participant and we always start off sending completed
+        // if the participant is not recovered
+        this.checkStatus = recovered;
     }
 
     /**
@@ -500,7 +508,11 @@
      */
     public void status(final StatusType status, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
     {
-        // KEV - implement
+        // TODO --  check that the status is actually what we expect
+
+        // revert to sending completed messages and reset the resend period to the initial period
+        checkStatus = false;
+        updateResendPeriod(false);
     }
 
     /**
@@ -528,7 +540,7 @@
 
         if (current == State.STATE_COMPLETED)
         {
-            sendCompleted();
+            sendCompleted(true);
         }
     }
 
@@ -538,18 +550,39 @@
      * @param addressingProperties The addressing context.
      * @param arjunaContext The arjuna context.
      * @message com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_1 [com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_1] - Unable to delete recovery record during soapFault processing for WS-BA participant {0}
+     * @message com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_2 [com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_2] - Cancelling participant {0}
+     * @message com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_3 [com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_3] - Notifying unexpected error for participant {0}
      */
     public void soapFault(final SoapFault soapFault, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
     {
         boolean deleteRequired;
+        boolean checkingStatus;
         synchronized(this) {
             deleteRequired = persisted;
+            // make sure delete is attempted only once
+            persisted = false;
+            checkingStatus = (state == State.STATE_COMPLETED && checkStatus);
             ended() ;
         }
-        // TODO -- clarify when and why this gets called and update doc in interface. also check unknown()
+        // TODO -- update doc in interface and user guide.
         try
         {
-            participant.error() ;
+            boolean isInvalidState = soapFault.getSubcode().equals(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME);
+            if (checkingStatus && isInvalidState) {
+                // coordinator must have died before reaching close so just cancel
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_2", new Object[] {id}) ;
+                }
+                participant.compensate();
+            } else {
+                // hmm, something went wrong -- notify the participant of the error
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine.soapFault_3", new Object[] {id}) ;
+                }
+                participant.error() ;
+            }
         }
         catch (final Throwable th) {} // ignore
         // if we just ended the participant ensure any log record gets deleted
@@ -858,7 +891,12 @@
         final AddressingProperties addressingProperties = createContext() ;
         try
         {
-            CoordinatorCompletionCoordinatorClient.getClient().sendCompleted(coordinator, addressingProperties, instanceIdentifier) ;
+            // if we are trying to reestablish the participant state then send getStatus otherwise send completed
+            if (timedOut && checkStatus) {
+                CoordinatorCompletionCoordinatorClient.getClient().sendGetStatus(coordinator, addressingProperties, instanceIdentifier); ;
+            } else {
+                CoordinatorCompletionCoordinatorClient.getClient().sendCompleted(coordinator, addressingProperties, instanceIdentifier) ;
+            }
         }
         catch (final Throwable th)
         {
@@ -889,11 +927,18 @@
                     newPeriod = maxResendPeriod;
                 }
                 resendPeriod = newPeriod;
+            } else {
+                // ok, we hit our maximum period last time -- this time switch to sending getStatus
+                checkStatus = true;
             }
         } else {
             if (resendPeriod > initialResendPeriod) {
                 resendPeriod = initialResendPeriod;
             }
+            // if we were previously checking status we need to revert to sending Completed
+            if (checkStatus) {
+                checkStatus = false;
+            }
         }
     }
 

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java	2009-02-12 16:38:42 UTC (rev 25244)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java	2009-02-12 17:16:21 UTC (rev 25245)
@@ -31,6 +31,7 @@
 import com.arjuna.webservices11.wsba.BusinessActivityConstants;
 import com.arjuna.webservices11.wsba.client.ParticipantCompletionCoordinatorClient;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionParticipantProcessor;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
 import com.arjuna.wst.FaultedException;
@@ -110,6 +111,11 @@
     private boolean persisted;
 
     /**
+     * true if the participant should send getstatus rather than resend a completed message
+     */
+    private boolean checkStatus;
+
+    /**
      * Construct the initial engine for the participant.
      * @param id The participant id.
      * @param coordinator The coordinator endpoint reference.
@@ -143,6 +149,9 @@
         this.maxResendPeriod = TransportTimer.getMaximumTransportPeriod();
         this.timeout = TransportTimer.getTransportTimeout();
         this.resendPeriod = initialResendPeriod;
+        // we always check the status of a recovered participant and we always start off sending completed
+        // if the participant is not recovered
+        this.checkStatus = recovered;
     }
 
     /**
@@ -427,7 +436,11 @@
      */
     public void status(final StatusType status, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
     {
-        // KEV - implement
+        // TODO --  check that the status is actually what we expect
+
+        // revert to sending completed messages and reset the resend period to the initial period
+        checkStatus = false;
+        updateResendPeriod(false);
     }
 
     /**
@@ -455,7 +468,7 @@
 
         if (current == State.STATE_COMPLETED)
         {
-            sendCompleted();
+            sendCompleted(true);
         }
     }
 
@@ -465,18 +478,39 @@
      * @param addressingProperties The addressing context.
      * @param arjunaContext The arjuna context.
      * @message com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_1 [com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_1] - Unable to delete recovery record during soapFault processing for WS-BA participant {0}
+     * @message com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_2 [com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_2] - Cancelling participant {0}
+     * @message com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_3 [com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_3] - Notifying unexpected error for participant {0}
      */
     public void soapFault(final SoapFault soapFault, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
     {
         boolean deleteRequired;
+        boolean checkingStatus;
         synchronized(this) {
             deleteRequired = persisted;
+            // make sure delete is attempted only once
+            persisted = false;
+            checkingStatus = (state == State.STATE_COMPLETED && checkStatus);
             ended() ;
         }
-        // TODO -- clarify when and why this gets called and update doc in interface. also check unknown()
+        // TODO -- update doc in interface and user guide.
         try
         {
-            participant.error() ;
+            boolean isInvalidState = soapFault.getSubcode().equals(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME);
+            if (checkingStatus && isInvalidState) {
+                // coordinator must have died before reaching close so just cancel
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_2", new Object[] {id}) ;
+                }
+                participant.compensate();
+            } else {
+                // hmm, something went wrong -- notify the participant of the error
+                if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    WSTLogger.arjLoggerI18N.warn("com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.soapFault_3", new Object[] {id}) ;
+                }
+                participant.error() ;
+            }
         }
         catch (final Throwable th) {} // ignore
         // if we just ended the participant ensure any log record gets deleted
@@ -768,7 +802,12 @@
         final AddressingProperties addressingProperties = createContext() ;
         try
         {
-            ParticipantCompletionCoordinatorClient.getClient().sendCompleted(coordinator, addressingProperties, instanceIdentifier) ;
+            // if we are trying to reestablish the participant state then send getStatus otherwise send completed 
+            if (timedOut && checkStatus) {
+                ParticipantCompletionCoordinatorClient.getClient().sendGetStatus(coordinator, addressingProperties, instanceIdentifier); ;
+            } else {
+                ParticipantCompletionCoordinatorClient.getClient().sendCompleted(coordinator, addressingProperties, instanceIdentifier) ;
+            }
         }
         catch (final Throwable th)
         {
@@ -799,11 +838,18 @@
                     newPeriod = maxResendPeriod;
                 }
                 resendPeriod = newPeriod;
+            } else {
+                // ok, we hit our maximum period last time -- this time switch to sending getStatus
+                checkStatus = true;
             }
         } else {
             if (resendPeriod > initialResendPeriod) {
                 resendPeriod = initialResendPeriod;
             }
+            // if we were previously checking status we need to revert to sending Completed
+            if (checkStatus) {
+                checkStatus = false;
+            }
         }
     }
 




More information about the jboss-svn-commits mailing list