Greetings, folks,
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.
My question is this: how does Infinispan handle the caching of mutable
objects?
For instance, taking org.infinispan.replication.SyncReplLockingTest 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.
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?
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?
Regards for any input.
Cheers,
Phill
PS I was playing with the infinispan-5.0.0.ALPHA4 release.
Show replies by date