You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Marcel Reutegger <ma...@gmx.net> on 2006/02/20 16:20:21 UTC

Re: svn commit: r378574 - /incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeState.java

just wanted to give some more details on the NodeState change I did last 
friday. Even though the actual code change is only minor, the underlying 
concept changed somewhat more significant.

Instead of cloning state information in NodeState on read, child node 
entries, mixin type names and property names are now cloned on write.

Mixin type names are copied on each write, as I think those change only 
rarely and the size of the collection is rather small.

Property names and in particular child node entries now have an 
additional flag that indicates if the collection is shared. The shared 
flag is set if the collection (prop names or child node entries) is 
shallow-copied in NodeState.copy(). From that point on the collection 
must not be changed anymore. If a NodeState modifies e.g. child node 
entries, it first has to check if it is shared and in effect read-only. 
If it is shared the NodeState then clones the read-only child node 
entries, modifies the resulting child node entries and resets the shared 
flag.

With this change the usage of ChildNodeEntries.clone() drops significantly.

# of clone() calls while running o.a.j.test.api.TestAll:

Before: ~84'000

After:   ~4'100

regards
  marcel

mreutegg@apache.org wrote:
> Author: mreutegg
> Date: Fri Feb 17 09:20:00 2006
> New Revision: 378574
> 
> URL: http://svn.apache.org/viewcvs?rev=378574&view=rev
> Log:
> - use copy-on-write in NodeState for: child node entries, mixin type names and property names.
> 
> Modified:
>     incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
> 
> Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
> URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=378574&r1=378573&r2=378574&view=diff