On 6.6.13 13:41, [email protected] wrote:
Author: jukka
Date: Thu Jun  6 12:41:28 2013
New Revision: 1490258

URL: http://svn.apache.org/r1490258
Log:
OAK-781: Clarify / fix effects of MISSING_NODE as base state of NodeBuilder

Fix the performance issue of a ConnectedHead never actually updating
the head state after a rebase. It would just repeatedly create new
UnconnectedHead instances without ever setting the head field. This
commit makes updating the head field the responsibility of the head()
method, which by centralizing the state transition should help avoid
potential other similar issues.

Thanks for finding this. Looks better now.

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java?rev=1490258&r1=1490257&r2=1490258&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
 Thu Jun  6 12:41:28 2013
@@ -142,7 +142,11 @@ public class MemoryNodeBuilder implement
       * @return  head of this builder
       */
      private Head head() {
-        return head.update();
+        Head newHead = head.update();
+        if (newHead != head) {
+            head = newHead;
+        }
+        return newHead;
      }

Isn't this the same as

return head = head.update()

??

Michael

Reply via email to