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

Manik Surtani manik at jboss.org
Fri Jul 20 11:27:04 EDT 2007


  User: msurtani
  Date: 07/07/20 11:27:04

  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.19 +42 -34    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.18
  retrieving revision 1.25.2.19
  diff -u -b -r1.25.2.18 -r1.25.2.19
  --- OptimisticValidatorInterceptor.java	19 Jul 2007 12:28:08 -0000	1.25.2.18
  +++ OptimisticValidatorInterceptor.java	20 Jul 2007 15:27:04 -0000	1.25.2.19
  @@ -123,8 +123,10 @@
           for (Iterator it = nodes.iterator(); it.hasNext();)
           {
               workspaceNode = (WorkspaceNode) it.next();
  +           if (workspaceNode.isDirty())
  +           {
               Fqn fqn = workspaceNode.getFqn();
  -            if (trace) log.trace("validating version for node " + fqn);
  +               if (trace) log.trace("Validating version for node [" + fqn + "]");
               OptimisticTreeNode realNode = (OptimisticTreeNode) cache._get(fqn);
   
               // if this is a newly created node then we expect the underlying node to be null.
  @@ -135,12 +137,13 @@
                   throw new DataVersioningException("Real node for " + fqn + " is null, and this wasn't newly created in this tx!");
               }
   
  -           if (realNode != null && workspaceNode.isCreated() && workspaceNode.isDirty())
  +              // needs to have been created AND modified - we allow concurrent creation if no data is put into the node
  +              if (realNode != null && workspaceNode.isCreated() && workspaceNode.isModified())
              {
                 throw new DataVersioningException("Tx attempted to create " + fqn + " anew.  It has already been created since this tx started by another (possibly remote) tx.");
              }
   
  -            if (!workspaceNode.isCreated() && (workspaceNode.isDeleted() || workspaceNode.isDirty()))
  +               if (!workspaceNode.isCreated() && (workspaceNode.isDeleted() || workspaceNode.isModified()))
               {
                  // if the real node is null, throw a DVE
                  if (realNode == null)
  @@ -160,6 +163,11 @@
                  }
               }
           }
  +           else
  +           {
  +               if (trace) log.trace("Node [" + workspaceNode.getFqn() + "] doesn't need validating as it isn't dirty");
  +           }
  +        }
       }
   
       private void commit(GlobalTransaction gtx)
  @@ -210,7 +218,7 @@
               {
                   // "Will somebody please think of the children!!"
                   // if (wrappedNode.hasCreatedOrRemovedChildren() handleChildNodes(wrappedNode);
  -                //if (wrappedNode.isDirty())
  +                //if (wrappedNode.isModified())
                   //{
                 OptimisticTreeNode current = (OptimisticTreeNode) wrappedNode.getNode();
                 boolean updateVersion = false;
  @@ -237,7 +245,7 @@
                     updateVersion = cache.getLockParentForChildInsertRemove();
                 }
   
  -               if (wrappedNode.isDirty() || wrappedNode.isCreated())
  +               if (wrappedNode.isModified() || wrappedNode.isCreated())
                  {
                       cache.notifyNodeModify(wrappedNode.getFqn(), true);
   
  
  
  



More information about the jboss-cvs-commits mailing list