jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angela Schreiber <anch...@adobe.com>
Subject Re: svn commit: r1440540 [1/2] - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/authori...
Date Thu, 31 Jan 2013 10:47:52 GMT
hi michael

feel free to revert it. i decided to change it as i will heavily
use ReadOnlyTree#getPath and i am sure it will have a negative
impact on overall system performance as it's within the
permission evaluation... that was the reason behind... but of course
i can build my own ReadOnlyTree implementation that keeps track
of the path...

angela

On 1/31/13 11:41 AM, Michael Dürig wrote:
>
> Hi,
>
> Preemptively building and caching the path here is worrisome since this
> will blow up memory usage quite a bit. This is the reason the path was
> only build on access (i.e. getPath()) in the original design and in
> TreeImpl.
>
> Michael
>
>
> On 30.1.13 17:33, angela@apache.org wrote:
>> +    /**
>> +     * Path of this tree
>> +     */
>> +    private final String path;
>> +
>> +    /**
>> +     * Underlying node state
>> +     */
>>        private final NodeState state;
>>
>> -    public ReadOnlyTree(NodeState root) {
>> -        this(null, "", root);
>> +    public ReadOnlyTree(NodeState rootState) {
>> +        this(null, "", rootState);
>>        }
>>
>> -    public ReadOnlyTree(ReadOnlyTree parent, String name, NodeState state) {
>> +    public ReadOnlyTree(@Nullable ReadOnlyTree parent, @Nonnull String name, @Nonnull
NodeState state) {
>>            this.parent = parent;
>>            this.name = checkNotNull(name);
>> +        this.path = buildPath(parent, name);
>>            this.state = checkNotNull(state);
>>            checkArgument(!name.isEmpty() || parent == null);
>>        }
>>
>> +    private static String buildPath(ReadOnlyTree parent, String name) {
>> +        if (parent == null) {
>> +            return "/";
>> +        } else if (parent.isRoot()) {
>> +            return parent.path + name;
>> +        } else {
>> +            StringBuilder sb = new StringBuilder();
>> +            sb.append(parent.path).append('/').append(name);
>> +            return sb.toString();
>> +        }
>> +    }

Mime
View raw message