[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
manik at jboss.org
Thu Jul 19 08:28:09 EDT 2007
User: msurtani
Date: 07/07/19 08:28:09
Modified: src/org/jboss/cache/interceptors Tag:
Branch_JBossCache_1_4_0
OptimisticValidatorInterceptor.java
Log:
JBCACHE-1067
Revision Changes Path
No revision
No revision
1.25.2.18 +16 -7 JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticValidatorInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java,v
retrieving revision 1.25.2.17
retrieving revision 1.25.2.18
diff -u -b -r1.25.2.17 -r1.25.2.18
--- OptimisticValidatorInterceptor.java 5 Jul 2007 19:10:28 -0000 1.25.2.17
+++ OptimisticValidatorInterceptor.java 19 Jul 2007 12:28:08 -0000 1.25.2.18
@@ -25,8 +25,8 @@
import javax.transaction.Transaction;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Map;
import java.util.List;
+import java.util.Map;
import java.util.Set;
/**
@@ -128,8 +128,9 @@
OptimisticTreeNode realNode = (OptimisticTreeNode) cache._get(fqn);
// if this is a newly created node then we expect the underlying node to be null.
+ // also, if the node has been deleted in the WS and the underlying node is null, this *may* be ok ... will test again later when comparing versions
// if not, we have a problem...
- if (realNode == null && !workspaceNode.isCreated())
+ if (realNode == null && !workspaceNode.isCreated() && !workspaceNode.isDeleted())
{
throw new DataVersioningException("Real node for " + fqn + " is null, and this wasn't newly created in this tx!");
}
@@ -141,11 +142,19 @@
if (!workspaceNode.isCreated() && (workspaceNode.isDeleted() || workspaceNode.isDirty()))
{
+ // if the real node is null, throw a DVE
+ if (realNode == null)
+ {
+ // but not if the WSN has also been deleted
+ if (!workspaceNode.isDeleted())
+ throw new DataVersioningException("Unable to compare versions since the underlying node has been deleted by a concurrent transaction!");
+ else
+ if (trace) log.trace("The data node ["+fqn+"] is null, but this is ok since the workspace node is marked as deleted as well");
+ }
+ else if (realNode.getVersion().newerThan( workspaceNode.getVersion() ))
+ {
// newerThan() will internally test if the DataVersion types being compared tally up, and will barf if
// necessary with an appropriate DataVersioningException.
-
- if (realNode.getVersion().newerThan( workspaceNode.getVersion() ))
- {
// we have an out of date node here
throw new DataVersioningException("DataNode [" + fqn + "] version " + ((OptimisticTreeNode)workspaceNode.getNode()).getVersion() + " is newer than workspace node " + workspaceNode.getVersion());
}
More information about the jboss-cvs-commits
mailing list