[jboss-user] [JBoss Cache: Core Edition] - Re: is it possible for MVCCInvocationContext to have null mv

manik.surtani@jboss.com do-not-reply at jboss.com
Thu Mar 12 11:46:18 EDT 2009


Had a look at your test, and your test is invalid. Here's why:

Case 1: You have commented out the line marked N1.  This works fine, since you first do a pFER() and then a get().  Expected behaviour.

Case 2: Line marked N1 is not commented out.  Here is what happens: 

1.  tx starts
2.  read the value, which is null
3.  do a pFER().  Remember that pFER(), to be fail-safe, runs in a separate transaction.  So this will suspend the tx started in 1, do the pFER(), and then resume the tx in 1.
4.  read the value again, you get a null.  This is correct, since you have REPEATABLE_READ specified.

Since line 3 happens outside the scope of the transaction, the transaction correctly treats this as a different, concurrent transaction modifying the value.  And since you have already read the value as null, you will always see it as null for the scope of the transaction.

As proof, try running your test either without the tx.begin() and tx.commit(), or specify a weaker isolation level like READ_COMMITTED.



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

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



More information about the jboss-user mailing list