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: ContentSession.getCurrentRoot() is slow
Date Fri, 14 Sep 2012 07:55:41 GMT

On Fri, Sep 14, 2012 at 7:32 AM, Thomas Mueller <mueller@adobe.com> wrote:
> This is actually what I expected that ContentSession.getCurrentRoot()
> would provide me: I expected getCurrentRoot() would always return the same
> root until the session has committed or refreshed. It wasn't obvious to me
> neither from the method name nor from the javadocs that there is
> (potentially) a new current root every time the method is called. Not a
> problem, I can change the javadocs and add that info.

Yep, the javadocs should probably be improved for this. The rationale
for not always returning the same root is to allow oak-jcr to
implement directly persisted operations like workspace copies without
having to acquire a separate ContentSession (and thus re-authenticate

> But now I see that the ContentSession doesn't in fact know the current
> revision and doesn't provide snapshot isolation, how do I use the same
> tree snapshot as the rest of the session? Is it the oak-jcr
> SessionDelegate.root field? I guess I will have to change the oak-core
> query API then, and add the Root as a parameter to the method
> SessionQueryEngine.executeQuery?

A better alternative might be to move the getQueryEngine() method from
ContentSession to Root. That way the returned QueryEngine instance can
already contain an internal reference to the relevant Root.


Jukka Zitting

View raw message