[jboss-user] [JBossCache] - Optimistic Locking

spennec do-not-reply at jboss.com
Mon Dec 10 03:51:05 EST 2007


Hello,

I read the documentation and didn't understand a part of it:

anonymous wrote : 
  | For example, if a transaction calls cache.getRoot().getChild( Fqn.fromString("/a/b/c") )  , nodes a, b and c are copied from the main data tree and into the workspace. The data is versioned and all calls in the transaction work on the copy of the data rather than the actual data. When the transaction commits, its workspace is merged back into the underlying tree by matching versions. If there is a version mismatch - such as when the actual data tree has a higher version than the workspace, perhaps if another transaction were to access the same data, change it and commit before the first transaction can finish - the transaction throws a RollbackException  when committing and the commit fails.
  | 

Is TreeCache going to follow this behaviour even during read calls? In the case of a thread that reads a value, while another one is modifying that same value, does the reader thread get an Exception?

The kind of bahaviour that I need is this:
- All reads can get the value immediately
- All writes must wait for another write to finish to get a lock
- A read call that happens while a writer thread locks the data recieves the data that was in the cache before the lock. In other words, the data is visible to other thread only once the writer thread has committed.

Would that be possible with Optimistic locking?

Thanks for your help :-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111530#4111530

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111530



More information about the jboss-user mailing list