Greetings, folks,<div><br></div><div>I've been tasked by my company with investigating Infinispan as a distributed cache solution. I've played around with the tests that come with it but I still have some questions. I hope this is an appropriate forum in which I can ask them.</div>
<div><br></div><div>My question is this: how does Infinispan handle the caching of mutable objects? </div><div><br></div><div>For instance, taking <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">org.infinispan.replication.SyncReplLockingTest<span class="Apple-style-span" style="font-family: arial; font-size: small; "> as a template, I wrote some test code in which a reading thread gets a reference to a particular element in the cache (within a transaction). While the transaction of this reading thread was still in-flight, an updating thread was able to mutate the object (also within a transaction). Since reading and updating threads have a reference to the same object, race conditions are introduced. </span></span></div>
<div><br></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><span class="Apple-style-span" style="font-family: arial; font-size: small; ">Note: the reading thread never explicitly locked this element in the cache. I just assumed there would be some implicit locking. It could explicitly lock the object but wouldn't this degrade performance? Isn't this exactly why MVCC was used as a solution - to mitigate this overhead?</span></span></div>
<div><br></div><div>Furthermore, rolling back the transaction of the updating thread will not rollback the changes made to a mutable object. So, am I missing something? Am I approaching the problem the wrong way?</div><div>
<br></div><div>Regards for any input.</div><div><br></div><div>Cheers,</div><div><br></div><div>Phill</div><div><br></div><div>PS I was playing with the infinispan-5.0.0.ALPHA4 release.</div>