[jbosscache-commits] JBoss Cache SVN: r6254 - core/trunk/src/main/java/org/jboss/cache/mvcc.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Jul 14 06:53:06 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-07-14 06:53:05 -0400 (Mon, 14 Jul 2008)
New Revision: 6254

Modified:
   core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
Log:
Corrected version skew check not using data versions.

Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java	2008-07-14 08:21:45 UTC (rev 6253)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java	2008-07-14 10:53:05 UTC (rev 6254)
@@ -6,7 +6,7 @@
 import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.invocation.InvocationContext;
-import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.invocation.NodeInvocationDelegate;
 import org.jboss.cache.optimistic.DataVersioningException;
 
 /**
@@ -33,11 +33,10 @@
       changed = true;
 
       // check for write skew.
-      NodeSPI underlyingNode = container.peek(fqn, false, true);  // even check for invalid nodes.  we should check tombstones too.
-      DataVersion underlyingNodeVersion = underlyingNode == null ? null : underlyingNode.getVersion();
+      NodeInvocationDelegate underlyingNode = (NodeInvocationDelegate) container.peek(fqn, false, true);  // even check for invalid nodes.  we should check tombstones too.
       // TODO: See if data versions are even needed in the first place!!
       //if (!allowWriteSkew && underlyingNode != null && !node.getVersion().equals(underlyingNodeVersion))
-      if (!allowWriteSkew && underlyingNode != null && underlyingNode != node)
+      if (!allowWriteSkew && underlyingNode != null && underlyingNode.getDelegationTarget() != node)
       {
          String errormsg = new StringBuilder().append("Detected write skew on Fqn [").append(fqn).append("].  Another process has changed the node since we last read it!").toString();
          if (log.isWarnEnabled()) log.warn(errormsg + ".  Unable to copy node for update.");




More information about the jbosscache-commits mailing list