4 Replies Latest reply on Nov 24, 2012 6:02 AM by dan.berindei

    Infinispan and Transactions

    mandarbk

      I am using JBoss As 7.1.1 Final.

      I have configured a replicated cache with transaction mode 'FULL_XA'.

       

      I am using the cache as an in memory data base.The entries in the cache are manipulated(add/update/delete) by the application.

      I am facing a scenario where a JTA transaction rollback does not revert the earlier addition of an entry in the cache.

      Infinispan documentation specifies a transaction manager to be configured for the cache. I believe that on a JBoss application server, infinispan should automatically be able to choose the correct transaction manager.Moreover, the infinispan 1.2 XSD do not provide any details on how should we configure a transaction manager for the cache.

      Do we really need to configure a transaction manager here ?

      If not, what could be a probable cause of cache addition not being rolled back after transaction rollback.

        • 1. Re: Infinispan and Transactions
          mandarbk

          Does infinispan provide the ability to remove previously added entry in the cache once the corresponding transaction is rolled back ?

          This is essentially the same Atomicity guarantees provided by a persistent datastore such as RDBMS.

          • 2. Re: Infinispan and Transactions
            dan.berindei

            Actually Infinispan doesn't write anything to the cache until the transaction is committed, so there's nothing to roll back - provided that the cache really is transactional, the default is not.

             

            You can enable transactions via the transactionMode attribute of the transaction element. There's an attribute for customizing the transaction manager lookup as well (transactionManagerLookupClass), but as you guessed the default should work with AS7.

            • 3. Re: Infinispan and Transactions
              mandarbk

              Finally, I was able to resolve the issue.Looks like the application code was modifying the value(map) stored in the cache. Since it was not a cache operation as such, those modifications were persistent even if the transaction is rolled back. My mistake....

              • 4. Re: Infinispan and Transactions
                dan.berindei

                NP Mandar, I'm glad to hear you figured it out!