-
1. Re:
aditsu Nov 14, 2007 6:12 AM (in response to spennec)Just do all those things within a transaction. Locks should be acquired automatically.
Adrian -
2. Re:
manik Nov 14, 2007 6:45 AM (in response to spennec)If you want to specifically get a write lock on the parent node as well, look at:
http://labs.jboss.com/file-access/default/members/jbosscache/freezone/docs/1.4.1.SP4/TreeCache/en/html_single/index.html#d0e2123
and look for the LockParentForChildInsertRemove attribute. -
3. Re:
spennec Nov 14, 2007 7:01 AM (in response to spennec)Thanks for your reply :-)
Should I use a specific Node Locking Scheme to ensure that behaviour? At the moment, I use Optimistic scheme (and, consequently, no Isolation Level). -
4. Re:
spennec Nov 14, 2007 7:05 AM (in response to spennec)Here's what's happenning at the moment:
A transaction:
- put some data in the cache.
Another transaction:
- modify its definition -> remove() is called
- update its value -> put() is called with the new value
The problem is that if I call get() on that node between the remove() and the put(), I still obtain the old value, but shouldn't I obtain null?? -
5. Re:
manik Nov 14, 2007 12:03 PM (in response to spennec)LockParentForChildInsertRemove works with both optimistic and pessimistic locking.
You won't receive a null in your above scenario since the write (in this case, the remove() call) will not be visible to other threads until the transaction commits. -
6. Re:
spennec Nov 15, 2007 1:45 AM (in response to spennec)Manik,
Thanks for the info on LockParentForChildInsertRemove, I'm going to try that.