I'm using JBoss EAP 6.0.1.GA (AS 7.1.3.Final) and the bundled Infinispan 'Brahma' 5.1.8.Final. I've configured Infinispan to be use a replicated, synchronous cache with isolation level = SERIALIZABLE and enabled batching on the cache.
Sample code I'm running:
Cache<String, List> cache = cacheContainer.getCache();
cache.startBatch();
List data = cache.get(key);
data.add(some value);
cache.put(key, data);
cache.endBatch(true);
edit Try as I might, if 2 nodes call this same block at the same time, every so often the data list only contains data from one node. It looks like it's a "* read" problem of various isolation levels, which I thought I guaranteed wouldn't happen by setting the isolation level to Serializable. /edit
I've also tried using an AdvancedCache, where my code would first do this to try to get the transaction lock as early as possible:
// javadocs on this flag seem to indicate this is a good idea if doing a get-update-put
Cache<String, List> cache = cacheContainer.getCache();
AdvancedCache<String, List> advancedCache =
cache.getAdvancedCache().withFlags(Flag.FORCE_WRITE_LOCK);
I've also played around with setting the transaction mode (NON_XA / Pessimistic), but I don't think that matters if I'm not actually using big-T Transactions (because of using batching instead)? And changing transaction modes I still see the above scenario occasionally).
Is there some code or configuration I'm missing or that is incorrect here?