Val, we understand what you said. What we do is trying to change the cached 
object in local, then, when transaction (not cache transaction) ends, we will 
first call cachedObject = cache.get(key), then immediately call cache.put(key, 
cachedObject) to sync all distributed nodes. We have a point cut to intercept 
the transaction, so we do not need to change lots of classes and improve 
performance. This requires to get original cached object reference.

I tried CacheConfiguration.setCopyOnRead(false), it does not return original 
object reference each time calling cache.get();

Thanks

Jimmy



-----Original Message-----
From: vkulichenko [mailto:[email protected]]
Sent: Tuesday, March 22, 2016 3:35 PM
To: [email protected]
Subject: RE: Is there a way to get original object reference from IgniteCache?

Jimmy,

Ignite is a distributed system and the approach you're describing doesn't make 
much sense for it. If the value is fetched from a remote node, you will always 
get a copy. If you get the value locally, you can force Ignite to return the 
stored instance by setting
CacheConfiguration.setCopyOnRead(false) property, but this should be used only 
in read-only scenario. It's not safe to modify this instance, because the 
serialized form will not be updated until you call cache.put(), so the one that 
reads it will potentially get the old value. Additionally, it can be 
concurrently serialized which can cause data corruption.

I understand that this is a big change, but looks like you will have to revisit 
your architecture and make sure that you use Ignite API properly.

Makes sense?

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Is-there-a-way-to-get-original-object-reference-from-IgniteCache-tp3611p3623.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
E-mail correspondence to and from this address may be subject to the
North Carolina public records laws and if so, may be disclosed.

Reply via email to