Jukka Zitting wrote:
Hi,

On 6/20/06, Torgeir Veimo <[EMAIL PROTECTED]> wrote:
On Tue, 2006-06-20 at 12:12 +0200, Marcel Reutegger wrote:
> well, you can reuse the session, but you must not shared it among
> multiple threads. Unless you synchronize access to the session.

What's the recommended practice with web application? doing a login and
logout for each request?

There are a number of different patterns with different benefits and
drawbacks. Some examples:

1) Session per request. This is the simplest solution but not very
performant at least with the Jackrabbit architecture.

I tried doing this, by doing a new login per request, but when the method returns a Node, yet still does a session.logout(), the Node itself seems to be unsable, as I get an exception;

javax.jcr.RepositoryException: this session has been closed
at org.apache.jackrabbit.core.SessionImpl.sanityCheck(SessionImpl.java:340) at org.apache.jackrabbit.core.ItemImpl.sanityCheck(ItemImpl.java:154)
        at org.apache.jackrabbit.core.NodeImpl.getName(NodeImpl.java:1714)
[...]

So it seems that as long as any objects retrieved from a session is still used, one cannot log out from the session. Correct?


--
-Torgeir

Reply via email to