[infinispan-dev] AtomicMap and mutable objects

Manik Surtani manik at jboss.org
Fri Dec 3 06:08:14 EST 2010


On 3 Dec 2010, at 11:03, Emmanuel Bernard wrote:

> 
> On 3 déc. 2010, at 11:13, Manik Surtani wrote:
> 
>> Hi Emmanuel.
>> 
>> With RepeatableRead, tx2 won't see the update till tx1 commits because the update (map.put()) is held in a change list until the tx is committed, before it is applied to the underlying AtomicMap.  (Remember, what you get is a proxy).
>> 
>> Ah, I see your question though; assuming the reference to the date is the same.  Hmm, in this case you may well see the change before tx1 commits, we don't explicitly clone or copy mutable objects.  We assume objects in an atomic map are immutable.  I suppose though we could add the ability to defensively copy mutable objects, but we'd need a way of knowing which are immutable, etc.  Also, this would be more expensive, depending on the size of the atomic map.
> 
> Hibernate has all the knowledge (mutable vs immutable and deep copy strategy) to do this kind of copy when appropriate. So this is not 100% needed in Infinispan though I think that could be less disturbing for people if you guys eventually implement something like that.
> 
> In any case a small doc entry would be nice :)

+1 on the docs, for sure.  

--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org







More information about the infinispan-dev mailing list