[jbosscache-commits] JBoss Cache SVN: r5122 - core/trunk/src/main/java/org/jboss/cache/invocation.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Jan 14 09:53:44 EST 2008


Author: manik.surtani at 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)




More information about the jbosscache-commits mailing list