Working with an ignite cache and I leave the H2 Debug window open while I'm working.. So what I have noticed happening is that when I change values in an object, this is IMMEDIATELY changed in the H2 Database window, even if I start a transaction.. Should this happen only when I get and put a value into the cache.. Should the objects not be "detached"?
So the question is how does this work? How would i control concurrency if multiple threads are accessing the Cache?
It's strongly recommended that you don't mutate the instance that is already in cache. It can cause all different types of concurrency issues (for example, if it's concurrently serialized).
Actually, by default cache should create a copy each time you read the value. Did you set CacheConfiguration.copyOnRead property to false? If no, this can be a bug, please provide details on how you read from cache (code sample would be very useful as well).
In any case, you can always manually create a copy before doing modifications. This should fix the behavior.
I have meetings most of today.. I will definitely get you a code Sample..
copyOnRead is set to true.
Will work around it and try to get you code examples later today..
Basically this is easy to re-produce though, all you have to do is do a query and pull an object out of the QueryCursor and change it while watching the H2Debug window.. You'll see the values in H2 change immediately.