[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...

Manik Surtani manik at jboss.org
Thu Jul 19 08:56:21 EDT 2007


  User: msurtani
  Date: 07/07/19 08:56:21

  Modified:    src/org/jboss/cache/interceptors 
                        OptimisticValidatorInterceptor.java
  Log:
  JBCACHE-1067
  
  Revision  Changes    Path
  1.63      +13 -3     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.62
  retrieving revision 1.63
  diff -u -b -r1.62 -r1.63
  --- OptimisticValidatorInterceptor.java	23 May 2007 15:22:03 -0000	1.62
  +++ OptimisticValidatorInterceptor.java	19 Jul 2007 12:56:21 -0000	1.63
  @@ -94,8 +94,9 @@
            underlyingNode = cache.peek(fqn, true);
   
            // 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 (underlyingNode == null && !workspaceNode.isCreated())
  +         if (underlyingNode == null && !workspaceNode.isCreated() && !workspaceNode.isDeleted())
            {
               throw new DataVersioningException("Underlying node for " + fqn + " is null, and this node wasn't newly created in this transaction!  We have a concurrent deletion event.");
            }
  @@ -107,8 +108,17 @@
   
            if (!workspaceNode.isCreated() && (workspaceNode.isDeleted() || workspaceNode.isDirty()))
            {
  +            // if the real node is null, throw a DVE
  +            if (underlyingNode == 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");
  +            }
               // if there is a DataVersion type mismatch here, leave it up to the DataVersion impl to barf if necessary.  - JBCACHE-962 
  -            if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
  +            else if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
               {
                  // we have an out of date node here
                  throw new DataVersioningException("Version mismatch for node " + fqn + ": underlying node with version " + workspaceNode.getNode().getVersion() + " is newer than workspace node, with version " + workspaceNode.getVersion());
  
  
  



More information about the jboss-cvs-commits mailing list