2 Replies Latest reply on Apr 25, 2012 11:27 AM by rakhaoui

    Synchronization jta

    rakhaoui

      hi, how can i register a transaction synchronization listener ? i created an implementation of Synchronization interface but i dont know which file config  to modify !

        • 1. Re: Synchronization jta
          mmusgrov

          It defined in the javax.transaction.Transaction interface.

          You get the current transaction from the transaction manager via javax.TransactionManager.getTransaction

          You get the transaction manager via JNDI lookup.

           

          As far as I'm aware the JTA spec does not mandate that the TM is exposed in this way but if it is then it does not mandate what JNDI name should be used.

           

          So you need to check the documentation for whichever JEE server you are using, for example AS7 registers it as java:jboss/TransactionManager.

          • 2. Re: Synchronization jta
            rakhaoui

            thank you for your response,

            i found TransactionManager.registerSynchronization method

             

             

             

             

            TransactionManager utx1 =

            (TransactionManager)  new InitialContext().lookup("java:/TransactionManager

            );

            utx1.begin();

            utx1.getTransaction().registerSynchronization(

            new

            MyUserTransactionListener());