Chris Poulsen created JCR-4172:
----------------------------------
Summary: JCAManagedConnection only considers the most recent
handle when getting session
Key: JCR-4172
URL: https://issues.apache.org/jira/browse/JCR-4172
Project: Jackrabbit Content Repository
Issue Type: Bug
Components: jackrabbit-jca
Affects Versions: 2.15.5
Environment: JTA/JCA enabled env.
Reporter: Chris Poulsen
The code for checking JCASessionHandle validity only considers the most recent
handle, even though there are several valid handles for the underlying session.
Steps to reproduce in a JCA environment:
Start TX
Session s1 = repository.login( credentials() );
Session s2 = repository.login( credentials() );
s1.getRootNode();
The exception thrown is:
java.lang.IllegalStateException: Inactive logical session handle called
at
org.apache.jackrabbit.jca.JCAManagedConnection.getSession(JCAManagedConnection.java:350)
at
org.apache.jackrabbit.jca.JCASessionHandle.getSession(JCASessionHandle.java:90)
at
org.apache.jackrabbit.jca.JCASessionHandle.getRootNode(JCASessionHandle.java:141)
at AppTest$3.doInTransactionWithoutResult(AppTest.java:121)
at
org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:139)
at AppTest.txSessionAffinity(AppTest.java:115)
The getSession looks like this:
/**
* Return the session.
*/
public Session getSession(JCASessionHandle handle) {
synchronized (handles) {
if ((handles.size() > 0) && (handles.get(0) == handle)) {
return session;
} else {
throw new java.lang.IllegalStateException("Inactive logical
session handle called");
}
}
}
I think the:
if ((handles.size() > 0) && (handles.get(0) == handle)) {
Should be:
if ( handles.contains( handle ) ) {
I've tried rolling my own JCA archive with this code and then things work like
expected.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)