jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: Node/Property operations after a session.logout()
Date Mon, 17 Mar 2008 17:24:47 GMT
hi frederic

On Fri, Mar 14, 2008 at 8:25 PM, Frederic Laugier <hint@dementia7.net> wrote:
> Hi everyone,
>  We had a bug in a Jackrabbit application that was calling node
>  operations after the session that retreived those nodes was logged out.
>  The problem was that no exception were thrown (which i thought would
>  happen since the session was closed).
>  The application is en EJB3 that retreives JCR Session using the JCA adaptor.
>  I wrote the following simple test case trying to see where was the problem :
>  public void testClose() throws Exception {
>   Session session = openSession();
>   Node root = session.getRootNode();
>   session.logout();
>   try {
>     root.getProperties();
>     fail("Should throw an exception ?");
>   } catch (Exception e) {
>     // no-op
>   }
>  }
>  The first time i ran the test case, it worked. The 'openSession' method
>  returned a simple Session (not one obtained via JCA)
>  I runned the same test with a JCA obtained Session and then the test failed.
>  My question is whether or not a node operation should fail when the
>  session that retreived it is closed ?

operations on a javax.jcr.Node instance should fail once the associated
javax.jcr.Session has been closed.

>  I looked deeper in the code and it seems that when a JCR Session is
>  closed, the underlying XASession stays 'live', allowing node operations
>  to be performed. I don't know is it has some side effects but I think
>  that the XASession should be closed as well when the JCA Session closes
>  (I may be wrong here, I have to admit that I don't know much about JCA).

neither do i ;)

just a random guess: JCA might be using a Session pool and closing such
a pooled Session would probably not close the underlying javax.jcr.Session
but just return it to the pool. i don't know whether that's
legitimate/expected or not.


>  Best regards,
>  Frederic.

View raw message