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

Manik Surtani msurtani at jboss.com
Tue Sep 12 09:12:51 EDT 2006


  User: msurtani
  Date: 06/09/12 09:12:51

  Modified:    src/org/jboss/cache   NodeImpl.java TreeCacheProxyImpl.java
  Log:
  Fixed locking issue when adding child nodes
  
  Revision  Changes    Path
  1.13      +2 -2      JBossCache/src/org/jboss/cache/NodeImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NodeImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/NodeImpl.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- NodeImpl.java	7 Sep 2006 15:42:15 -0000	1.12
  +++ NodeImpl.java	12 Sep 2006 13:12:51 -0000	1.13
  @@ -324,7 +324,7 @@
               child = (NodeImpl) children().get(child_name);
               if (child == null)
               {
  -               cache.getNotifier().notifyNodeCreated(child.getFqn(), true);
  +               cache.getNotifier().notifyNodeCreated(child_fqn, true);
                  child = newChild;
                  children.put(child_name, child);
                  if (gtx != null)
  @@ -345,7 +345,7 @@
               {
                  log.trace("created child: fqn=" + child_fqn);
               }
  -            cache.getNotifier().notifyNodeCreated(child.getFqn(), false);
  +            cache.getNotifier().notifyNodeCreated(child_fqn, false);
            }
         }
         return child;
  
  
  
  1.30      +8 -9      JBossCache/src/org/jboss/cache/TreeCacheProxyImpl.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheProxyImpl.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCacheProxyImpl.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -b -r1.29 -r1.30
  --- TreeCacheProxyImpl.java	11 Sep 2006 17:02:43 -0000	1.29
  +++ TreeCacheProxyImpl.java	12 Sep 2006 13:12:51 -0000	1.30
  @@ -10,7 +10,6 @@
   import org.jboss.cache.buddyreplication.BuddyManager;
   import org.jboss.cache.config.Configuration;
   import org.jboss.cache.eviction.RegionManager;
  -import org.jboss.cache.factories.NodeFactory;
   import org.jboss.cache.interceptors.Interceptor;
   import org.jboss.cache.loader.CacheLoader;
   import org.jboss.cache.loader.CacheLoaderManager;
  @@ -218,11 +217,9 @@
   
      private void evictChildren(NodeImpl n)
      {
  -      Map children = n.getChildren();
  -      Iterator childNames = children.keySet().iterator();
  -      while (childNames.hasNext())
  +      Map<Object, NodeImpl> children = n.getChildren();
  +      for (NodeImpl child : children.values())
         {
  -         NodeImpl child = (NodeImpl) children.get(childNames.next());
            evictChildren(child);
         }
         treeCache.evict(n.getFqn());
  @@ -309,8 +306,9 @@
   
            if (f.size() == 1)
            {
  -            newNode = (NodeImpl) NodeFactory.getInstance().createNode(f.getLast(), currentNode, Collections.EMPTY_MAP, treeCache);
  -            treeCache._addChild(gtx, currentNode.getFqn(), f.getLast(), newNode, true);
  +            //newNode = (NodeImpl) NodeFactory.getInstance().createNode(f.getLast(), currentNode, Collections.EMPTY_MAP, treeCache);
  +            //treeCache._addChild(gtx, currentNode.getFqn(), f.getLast(), newNode, true);
  +            newNode = (NodeImpl) currentNode.getOrCreateChild(f.getLast(), gtx, true);
               retval = new TreeCacheProxyImpl(treeCache, newNode);
            }
            else
  @@ -319,9 +317,10 @@
               NodeImpl currentParent = currentNode;
               for (Object o : f.peekElements())
               {
  -               newNode = (NodeImpl) NodeFactory.getInstance().createNode(o, currentParent, Collections.emptyMap(), treeCache);
  +               //newNode = (NodeImpl) NodeFactory.getInstance().createNode(o, currentParent, Collections.emptyMap(), treeCache);
                  //currentParent.addChild(o, newNode);
  -               treeCache._addChild(gtx, currentParent.getFqn(), o, newNode, true);
  +               //treeCache._addChild(gtx, currentParent.getFqn(), o, newNode, true);
  +               newNode = (NodeImpl) currentParent.getOrCreateChild(o, gtx, true);
                  currentParent = newNode;
               }
               retval = new TreeCacheProxyImpl(treeCache, currentParent);
  
  
  



More information about the jboss-cvs-commits mailing list