[infinispan-dev] AtomicMap and mutable objects

Emmanuel Bernard emmanuel at hibernate.org
Fri Dec 3 04:47:12 EST 2010


Hey Manik and all,

We had a talk at Devoxx on AtomicMap and tx isolation but its back to fuzzyness to me. can you help me reclarify.

Here is the scenario.

In Tx1
 Map map = (AtomicMap) cache.get( key1 );
 Date updateDate = map.get("date");
 updateDate.setTime( System.currentTimeMillis() );
 #cp 1
 map.put("date", updateDate);
End of Tx1

In Tx2
 Map map = (AtomicMap) cache.get( key1 );
 Date updateDate = map.get("date");
 #cp2
 display(updateDate);
End of Tx2

Provided Date is mutable and assuming Tx1 and Tx2 run in the same node. Could it be that Tx2 display the new value of updateDate before Tx1 is committed. Or are you guys copying on read mutable objects?

Emmanuel


More information about the infinispan-dev mailing list