Hi, I have a probem with infinispan inside jboss AS 7.
<cache-container name="myCacheContainerMappedName"
default-cache="serialRunningSessions" jndi-name="java:jboss/myCacheContainerMappedName"
start="EAGER">
<transport lock-timeout="60000" />
<replicated-cache name="serialRunningSessions"
mode="SYNC" batching="true">
<locking isolation="REPEATABLE_READ" />
<transaction mode="NON_DURABLE_XA" />
</replicated-cache>
.................
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class MyCacheManagerBean implements MyCacheManager{
@Resource(mappedName = "java:jboss/myCacheContainerMappedName")
private EmbeddedCacheManager container;
................
LoadingSession oldSession = (LoadingSession) container.getCache().putIfAbsent(session.getLoadingCacheKey(), session);
.............
}
I have this cache configuration. During my elaboration I put an object into this cache inside an EJB method , the transaction attribute of the EJB is REQUIRES_NEW.
If the transaction is rollback the object that I put into the infispan cache stay into the cache.
What is the problem?
If the container transaction si rollback, why infispan cache keep the object ?
Thanks in advance
Ok, I found the solution...
1) batching attribute mus be set to false.
2) If I want that infinispan mark the transaction for rollback then I need to throw an instance of org.infinispan.CacheException