Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-4172

JCAManagedConnection only considers the most recent handle when getting session

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.15.5
    • None
    • jackrabbit-jca
    • None
    • JTA/JCA enabled env.
    • Patch

    Description

      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)
        Unknown macro: { 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            chrispoulsen Chris Poulsen
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: