i have a got situation here. I configured the cache in local mode with transaction management. The objects i am storing is a mutable object. When two threads trying to get the value for the same key and updates with a different value , both are able to get the value at the same time since there is no lock acquisition while reading. Eventhough the put operation acquires lock on the same key , my updates to the cache is not consistent since the read value reference is share across threads.
Is it possible to acquire a common lock for read and write ? or is there any other way of doing the same.... or correct me if i am wrong.