5 Replies Latest reply on Apr 30, 2012 12:13 PM by vblagojevic

    Suspending and Resuming Tx issues

    an1310

      Hi all,

       

      I'm probably going to hit myself when I see the solution to this..

       

      https://gist.github.com/2499458

       

      The above code occasionally fails: java.util.concurrent.ExecutionException: org.infinispan.CacheException: javax.transaction.NotSupportedException: Transaction already active, cannot nest transactions.  This exception occurs at the first tm.begin() statement.

       

      A brief explanation.  This is a DistributedCallable.  The first transaction locks an aggregate key that is representative of the keys in the three caches involved in this transaction.  The lock is acquired and suspended in the first transaction so the lock is released once the new transaction completes.  This way, I can guarantee exclusive access to the resources in the three caches without explicitly acquiring those locks.