12 Replies Latest reply on Feb 28, 2008 10:32 AM by adinn

    What happens when participant compensation fails

    b_

      Hi,

      Can someone please detail what happens when the participant is asked to compensate the work done, and compensation fails?

      Also under what circumstances are the .unkown() and .error() methods invoked on the participant?

        • 1. Re: What happens when participant compensation fails
          marklittle

          Have you read the standard document? Also there are docs on our labs page. There is also a manual that ships with the XTS component that discusses much of this.

          • 2. Re: What happens when participant compensation fails
            b_

             

            Have you read the standard document? Also there are docs on our labs page. There is also a manual that ships with the XTS component that discusses much of this.


            I have gone through the programmers guide (xts home/docs) and also went through the Administration, Programmers and quick start guide (jbossTs home\docs\user_guide). Are you referring to those?

            Please help me if i'm missing something.


            Thanks!

            • 3. Re: What happens when participant compensation fails
              marklittle

              Check out the docs on our labs page as well as the Standards documentation.

              • 4. Re: What happens when participant compensation fails
                b_

                Maybe i wasn't clear enough ...

                In the document it says that:

                error: during recovery the participant can enquire as to the status of the transaction it was registered with. If an error occurs (e.g., the transaction service is unavailable) then this operation will be invoked.


                Is the status enquiry operation something that is done implicitly by the underlying framework or is it something that is done explicitly within the business logic?

                As for a failing compensation i didn't read anything that is related. (or missed on it)

                • 5. Re: What happens when participant compensation fails
                  b_

                  Are you referring to the documents on this page ? :S

                  http://labs.jboss.com/jbosstm/docs/index.html

                  • 6. Re: What happens when participant compensation fails
                    marklittle

                    You should read the WS-TX 1.0 specification document. Try http://labs.jboss.com/jbosstm/resources/index.html

                    • 7. Re: What happens when participant compensation fails
                      b_

                       

                      
                      public void compensate() throws WrongStateException, SystemException {
                      
                       LLTOutput lltOutput = lltImpl.rollbackLLT(lltContext.getLLTId());
                      
                       if (lltOutput.getStatus().equals(LLTStatus.INDETERMINITE)){
                       throw (new SystemException("Compensation suspended"));
                       }
                      
                      ....
                      
                      


                      When a local transaction (referred to as long lived transaction ) returns an indeterminite state, compensation fails and i get the following warning in the logger:

                      15:19:48,140 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_54] - Top-level abort of action -3f57fd9a:4e1:47c41fde:2 received TwoPhaseOutcome.HEURISTIC_HAZARD from <ClassName:RecordType.USER_DEF_FIRST1>

                      The compensate method is then invoked repeatedly inifinitely ...and as a result jboss crashes and has to be restarted!

                      • 8. Re: What happens when participant compensation fails
                        marklittle

                         

                        "mark.little@jboss.com" wrote:
                        You should read the WS-TX 1.0 specification document. Try http://labs.jboss.com/jbosstm/resources/index.html


                        It looks like some of those links are broken. I'll fix them.

                        • 9. Re: What happens when participant compensation fails
                          b_

                          Hi

                          Went through the docs you suggested once again (had already read them...but went through them again just in cased i missed something).

                          On the Ws-Business Activity Spec (specifically on page 8) there is a transition from the compensating to the fault stage. That pretty much describes the scenario i mentioned above ... i.e. the participant fails during compensation. However it is still not clear to me what happens in term of code execution.

                          Can you please clarify ...

                          Thanks

                          • 10. Re: What happens when participant compensation fails
                            adinn

                             


                            On the Ws-Business Activity Spec (specifically on page 8) there is a transition from the compensating to the fault stage. That pretty much describes the scenario i mentioned above ... i.e. the participant fails during compensation. However it is still not clear to me what happens in term of code execution.


                            Look at method executeCompensate of class ParticipantCompletionParticipantEngine. It is called from method compensate when the state is compensating and it tries to get the participant to actually do the compensation. If the participant returns a FaultedException then a fault message is sent to the coordinator and it should send back a faulted message.

                            Same applies for CoordinatorCompletionParticipantEngine.


                            • 11. Re: What happens when participant compensation fails
                              b_

                              Hi Adinn,

                              Thanks for the reply. Went through the code in ParticipantCompletionParticipantEngine class as you suggested.

                              I also tried debugging specifically the executeCompensate() method in the
                              ParticipantCompletionParticipantEngine class:

                              
                               private void executeCompensate()
                               {
                               try
                               {
                               participant.compensate() ;
                               }
                               catch (final FaultedException fe)
                               {
                               fault() ;
                               }
                               catch (final Throwable th)
                               {
                               ......
                              
                              


                              When line 5 is executed (i.e. participant.compensate()) a null pointer exception is returned ...and consequently program execution continues from the second catch clause!!! (i.e. A faulted Exception is not thrown as supposed!)

                              This is the code for the compensate method for my participant:


                              
                               public void compensate() throws WrongStateException, SystemException {
                              
                               LLTOutput lltOutput = lltImpl.rollbackLLT(lltContext.getLLTId());
                              
                               if ((lltOutput.getStatus().equals(LLTStatus.INDETERMINITE)) || (lltOutput.getStatus().equals(LLTStatus.SUSPENDED_COMPENSATION))) {
                               throw (new SystemException("Compensation suspended"));
                               }
                              
                               System.out.println("Theatre participant: compensate called. LLtOutput is " + lltOutput.getStatus().toString());
                              
                               }
                              
                              
                              
                              Am i missing something?
                              


                              • 12. Re: What happens when participant compensation fails
                                adinn

                                 


                                Am i missing something?


                                Well, I don't know about you, but I am definitely missing the fat cheque required if you are asking me to debug your code. Alternatively, you can buy a support contract, bring in an expert JBoss consultant and I'll negotiate a pay rise out of Red Hat. Those options aside I think you need to get your debugger revved up . . .