Author: manik.surtani(a)jboss.com
Date: 2008-01-14 09:53:44 -0500 (Mon, 14 Jan 2008)
New Revision: 5122
Modified:
   core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
Log:
JBCACHE-1263 - addChild() adds child even if one exists, causing unnecessary replication.
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java	2008-01-14
14:30:23 UTC (rev 5121)
+++
core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java	2008-01-14
14:53:44 UTC (rev 5122)
@@ -273,8 +273,13 @@
       // TODO: Revisit.  Is this really threadsafe?  See comment in putIfAbsent() - same
solution should be applied here too.
       assertValid();
       Fqn nf = new Fqn(getFqn(), f);
-      spi.put(nf, null);
-      return getChild(f);
+      Node<K, V> child = getChild(f);
+      if (child == null)
+      {
+         spi.put(nf, null);
+         child = getChild(f);
+      }
+      return child;
    }
 
    public boolean removeChild(Fqn<?> f)
    
    
    
 
                    
                    
                        
                        Show replies by date