jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: Tree.hasChild() / Tree.getChild()
Date Tue, 01 Oct 2013 13:09:19 GMT

On Tue, Oct 1, 2013 at 3:45 AM, Michael Dürig <mduerig@apache.org> wrote:
> We could remove the hasChild() method to enforce this pattern. As you say
> this is a leftover from the time we didn't have the exists() method. WDYT?

The double-checking pattern is a leftover, but the hasChild() method
as such still has a place. Depending on the backend, a getChild() call
may require the identified node to be fetched from the disk or over
the network (SegmentMK uses lazy loading to avoid this). So if we're
only interested in the existence of a node (like in
Session.nodeExists), hasChild() can in some cases be orders of
magnitude faster than getChild().


Jukka Zitting

View raw message