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

Elias Ross genman at noderunner.net
Mon Nov 20 03:51:50 EST 2006


  User: genman  
  Date: 06/11/20 03:51:50

  Modified:    src/org/jboss/cache/interceptors 
                        OptimisticValidatorInterceptor.java
  Log:
  JBCACHE-867 - Fix emptyMap versus null in notify; use correct Node.put()
  
  Revision  Changes    Path
  1.42      +5 -20     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.41
  retrieving revision 1.42
  diff -u -b -r1.41 -r1.42
  --- OptimisticValidatorInterceptor.java	20 Nov 2006 07:33:14 -0000	1.41
  +++ OptimisticValidatorInterceptor.java	20 Nov 2006 08:51:50 -0000	1.42
  @@ -198,7 +198,7 @@
                  cache.getNotifier().notifyNodeRemoved(dNode.getFqn(), true, dNode.getNodeSPI().getRawData());
                  DataNode parent = (DataNode) dNode.getParent();
                  parent.removeChild(dNode.getFqn().getLast());
  -               cache.getNotifier().notifyNodeRemoved(dNode.getFqn(), false, Collections.emptyMap());
  +               cache.getNotifier().notifyNodeRemoved(dNode.getFqn(), false, null);
               }
            }
            else
  @@ -216,13 +216,14 @@
                  // do we need to notify listeners of a modification??  If all we've done is added children then don't
                  // notify.
                  Map mergedData = wrappedNode.getMergedData();
  -               boolean needsNotify = !dataEquals(mergedData, current.getData());
  +               Map rawData = current.getRawData();
  +               boolean needsNotify = !mergedData.equals(rawData);
                  
                  if (needsNotify)
                  {
                     if (log.isTraceEnabled())
                        log.trace("inserting merged data " + mergedData + " for " + current);
  -                  cache.getNotifier().notifyNodeModified(wrappedNode.getFqn(), true, current.getData() == null ? Collections.emptyMap() : Collections.unmodifiableMap(current.getData()));
  +                  cache.getNotifier().notifyNodeModified(wrappedNode.getFqn(), true, rawData);
                  }
   
                  current.put(mergedData, true);
  @@ -242,7 +243,7 @@
   
                  if (needsNotify)
                  {
  -                  cache.getNotifier().notifyNodeModified(wrappedNode.getFqn(), false, mergedData == null ? Collections.emptyMap() : Collections.unmodifiableMap(mergedData));
  +                  cache.getNotifier().notifyNodeModified(wrappedNode.getFqn(), false, mergedData);
                  }
               }
               else
  @@ -259,22 +260,6 @@
   
      }
   
  -   private boolean dataEquals(Map map1, Map map2)
  -   {
  -      if (map1 == null)
  -      {
  -         return (map2 == null) || (map2.isEmpty());
  -      }
  -      if (map2 == null)
  -      {
  -         if (map1.isEmpty())
  -         {
  -            return true;
  -         }
  -      }
  -      return map1.equals(map2);
  -   }
  -
      private void rollBack(GlobalTransaction gtx)
      {
         TransactionWorkspace workspace;
  
  
  



More information about the jboss-cvs-commits mailing list