2 Replies Latest reply on Apr 26, 2005 7:12 AM by Robin Roos


    Robin Roos Newbie


      I need to register a Synchronization object which will receive afterCompletion() invocations - or the equivalent - AFTER all resources in the transaction have been committed.

      I could register against the javax.transaction.Transaction instance or against the javax.ejb.UserTransaction instance.

      Is either of these preferable? Is there a specific JNDI name I should use?

      My code runs variously within Stateless Session EJBs and Message-Driven EJBs.

      Thanks, Robin.

        • 1. Re: Synchronization
          Robin Roos Newbie

          Ok, I was not quite correct. I could register a Synchronization instance with javax.transaction.Tramsaction, or I could have my session beans implement SessionSynchronization.

          However I don't see an equivalent "MessageDrivenSynchronization" capability for MDBs.

          My experience of registering against javax.transaction.Transaction is that other infrastructure components do the same, and that the order of invocation of afterCompletion(boolean) is non-deterministic. The problem comes when an infrastructure component treats afterCompletion() as the place where it will do its own commit work. So my Synchronization instance is often called BEFORE all the commit work has been done.

          Is the Synchronization interface conceptually missing another entrypoint? We have one for before-commit, one for after-completion, but none for commit-now, so some adaptors use after-completion for that purpose....

          • 2. Re: Synchronization
            Robin Roos Newbie

            We have resolved this issue.

            Kind regards, Robin.