This content has been marked as final.
Show 3 replies
-
1. Re: locking & CacheSPI
mircea.markus Mar 10, 2008 2:10 PM (in response to nnnnn)When our application decides to write to the cache, it needs to check what's already at the node that's there, and then depending on what it finds, it may choose to put the new object in the cache in the same node, or it may decide not to. It's important that a different thread doesn't change the object at that key in that node in between the read and the write. Locking behavior is what we want - the other thread should wait until the first thread is done before writing.
you should open a transaction (REPETABLE_READ) which would only commit after the write. This will assure that the read data won't be modified by other thread until commit/rollback takes place. -
2. Re: locking & CacheSPI
nnnnn Mar 11, 2008 3:38 PM (in response to nnnnn)Right, that's what I would like to do. But how do I do that from application code without having my app code operate in an Interceptor? Am I missing something easy?
-
3. Re: locking & CacheSPI
manik Mar 12, 2008 9:43 AM (in response to nnnnn)Use a Transaction Manager (see the user guide for how to configure one) and start a user transaction before your cache operations (reads, writes). And then commit your transaction. The cache will participate in the transaction and treat all operations as scoped to the same ongoing transaction.