2 Replies Latest reply on Feb 25, 2013 12:49 PM by jeremystone

    Why is TransactionManagerLookup ignored when using batch mode?

    jeremystone

      We are using the Tree Cache API (and therefore must have invocation batching enabled) for some parts of our application.

       

      After upgrade from 5.1.6 to 5.2.0, even though we have a TransactionManagerLookup configured, the resulting JTA transaction manager is not being used for the cache. Instead (see org.infinispan.factories.TransactionManagerFactory) a BatchModeTransactionManager is used.

       

      The result is that we get something like the following when we try to access the cache (despite there being an active JTA transaction):

       

      java.lang.IllegalStateException: This is a tx cache!

                at org.infinispan.context.TransactionalInvocationContextContainer.createInvocationContext(TransactionalInvocationContextContainer.java:112)

                at org.infinispan.CacheImpl.getInvocationContext(CacheImpl.java:508)

                at org.infinispan.CacheImpl.getInvocationContextWithImplicitTransaction(CacheImpl.java:492)

                at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:770)

                at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:765)

                at org.infinispan.CacheSupport.putIfAbsent(CacheSupport.java:78)

                at org.infinispan.atomic.AtomicHashMap.newInstance(AtomicHashMap.java:76)

                at org.infinispan.atomic.AtomicMapLookup.getMap(AtomicMapLookup.java:144)

                at org.infinispan.atomic.AtomicMapLookup.getAtomicMap(AtomicMapLookup.java:90)

                at org.infinispan.atomic.AtomicMapLookup.getAtomicMap(AtomicMapLookup.java:59)

                at org.infinispan.tree.TreeStructureSupport.getAtomicMap(TreeStructureSupport.java:156)

                at org.infinispan.tree.TreeCacheImpl.get(TreeCacheImpl.java:220)

                at org.infinispan.tree.TreeCacheImpl.get(TreeCacheImpl.java:211)

       

      Your wiki entry https://community.jboss.org/wiki/BatchModeTransactionManager implies use of JTA with batch mode should be perfectly ok.

       

      It is interesting to note that tests that use a DummyTransactionManager will (by virtue of it sharing the same static thread local for the current Transaction with the BatchModeTransactionManager) not see this issue.

       

      I can provide test case if reqd.

       

      Thanks,

       

      Jeremy Stone