jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederic Laugier <h...@dementia7.net>
Subject Node/Property operations after a session.logout()
Date Fri, 14 Mar 2008 19:25:14 GMT
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();

  try {
    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 ?

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).

Best regards,

View raw message