You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Marcel Reutegger <mr...@adobe.com> on 2012/09/12 15:30:52 UTC

ContentSession.getCurrentRoot() usage

Hi,

AFAIU ContentSession.getCurrentRoot() will return the most
up to date version of the root, which provides access to a
snapshot of the tree. In oak-jcr this method is used when
a SessionDelegate is created and the root is initialized with
getCurrentRoot(). Later on this root is used for operations
on the tree.

now, there are also a lot of other places where getCurrentRoot()
is called. some of these look a bit suspicious to me. the
namespace registry and node type manager operate mostly
on fresh snapshots of the tree for each method call. doesn't
that always result in a call all the way down to the microkernel?
I know that both namespace and node type management are
considered repository wide and not bound to the current session,
but it seems excessive to always get a new snapshot for a
namespace uri to prefix mapping that rarely changes.

another usage I noticed is in Query.getTree(String). Shouldn't
the query rather operate on the same stable tree as seen by
the JCR session?

Regards
 Marcel