Menu

Ordering of commit calls

Help
2006-01-25
2013-06-04
  • Cameron Smith

    Cameron Smith - 2006-01-25

    I would like to know if Tyrex has a definitive order in which it will attempt to call commit on the XAResources of Resource Managers configured in a domain?

    My situation is this: I have 2 DataSources (Oracle JDBC) and 1 custom JCA connector (using a custom protocol to communicate with a remote system) all in the same XA.  This is working fine.

    However, for reasons specific to the custom protocol, the JCA connector cannot always guarantee that, after it has returned OK to the 'prepare' call, it will in fact be able to 'commit' successfully.  This is in breach of the XA/Open spec, we are aware of that fact.  However it is in fact not a huge issue AS LONG AS we can make sure that the failure to commit will stop the commit on the 2 Oracle DataSources.

    That is, we have a coping mechanism for 'manually' rolling back the JCA work from the transaction in this situation, whereas it would be extremely difficult to do this with the DB work.  So, if we could control in what order Tyrex calls commits on its RMs, after they have all said 'OK' at the prepare stage, this would be ideal.  For instance, does it follow the order of definition in domain.xml?

    I have tried looking through the source but it is fairly involved, with some iterations over RMs going front-to-back and others vice-versa.  If necessary I will plug a source build into our app, and stick logging and a debugger into it.  However, I thought I would first check if any Tyrex developer already knows the answer!

     
    • Cameron Smith

      Cameron Smith - 2006-01-30

      OK, after running through various tests and inspecting Tyrex's behaviour via a debugger, I found that Tyrex calls 'commit' in the REVERSE order in which a resource was obtained for the first time in the JVM from the Transaction Domain, via the method 'getResource' on 'tyrex.resource.Resources'.

      For instance, if you have 3 RMs and you access them from your JVM for the first time in this order:
      A
      B
      C

      Then the order in which prepare, and later commit, will be called is:
      C
      B
      A

      Note: the order of definition with the domain.xml file makes no difference at all!

       

Log in to post a comment.