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 ?
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,
Frederic.