[jboss-user] [JBoss Cache: Core Edition] - Pessimistic Locking

nathanmesser do-not-reply at jboss.com
Thu Feb 12 06:12:02 EST 2009


I'm not sure my understanding of pessimistic locking is correct, as I have a situation which is working but I don't understand why.

My understanding is that:
1) Locks are held for the duration of a transaction
2) Writers must wait until there are no read locks on a node

I have a transaction T1, which reads a node A from the cache, so it should have a read lock on the node.

This transaction is then suspended, when an EJB method is called with it's transaction attribute set to requiresNew. This transaction T2 then writes to the node. 

Transaction T2 then commits, and transaction T1 continues, and commits as well.

I'm using Pessimistic Locking with an Isolation Level of READ_COMMITTED

Why does T1s read lock not block T2s obtaining of the write lock?

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

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



More information about the jboss-user mailing list