1 Reply Latest reply on May 26, 2006 9:05 AM by Torsten Fink

    Last resource optimization

    Torsten Fink Newbie

      Hi,

      I have to use an XA-capable database and a non-XA-capable one together in a transaction.

      From the last JBoss-training, I attended, I know that JBossAS supports "last resource optimization". From what I understood, this means that if in a transaction there is 1 non-XA resource enlisted, this one is used last in the prepare phase of the two-phase-commit protocol. Thus it can skip the prepare and immedeately commits.

      Now my problem is that I do not find any documentation of this feature in the JBoss documentation. I saw that the new Transation service, the former Arjuna service, does support it partially.

      My questions:

      Does the standard-in-memory transaction monitor in combination with JCA support this "last resource optimization"?

      If yes, does this hold for all 4.0.x-versions?

      And finally, is this reordering of resources done automatically?

      Any answer/help would be really apreciated!

      Best regards,

      Torsten

        • 1. Re: Last resource optimization
          Torsten Fink Newbie

          Hi,

          a partial answer to my own post:

          I checked the sources from 4.0.4 and could see that this last resource optimization is implemented in:

          org.jboss.tm.TransactionImpl

          The 1st resource which is tagged with the LastResource interface is remembered in the field lastResource. Because LocalXAResource implements LastResource I guess that all local non-XA datasources are automatically last resources.

          In prepareResources() lastResource is ignored regarding the prepare() itself but at the end it is committed. In commitResources() it is just ignored.

          This is exactly the behavior I was told in that JBoss training.

          But I am still wondering if this is an official feature?

          -- Torsten

          PS: I am somehow surprised that there is no warning if a resource is added with the tag LastInterface and there is already a lastResource set (addResource(), Line 1446). This looks a little bit dangerous.