Uploaded image for project: 'Geronimo'
  1. Geronimo
  2. GERONIMO-594

Begin on TransactionManager always fails when thread is associated with a Tx

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 1.0-M3
    • Fix Version/s: None
    • Component/s: transaction manager
    • Labels:
      None

      Description

      The TransactionManager.begin() always throws an exception it thread is already associated with a transaction. This means the following code will fail:

      txManager.getTransaction().commit();
      txManager.begin();

      Also, I'm not sure if transaction.commit() should remove any thread association with the transaction.

        Activity

        Hide
        djencks David Jencks added a comment -

        The paragraph you refer to describes the behavior of TransactionManager.commit(), not Transaction.commit() which was the subject of my comment. There is no doubt whatsoever that TransactionManager.commit() must remove any transaction-thread association. This paragraph does not specify anything about the behavior of Transaction.commit().

        In section 3.3.3, Transaction.commit() is described briefly, and it's noted that the calling thread may have a different transaction association than the transaction it is calling commit on. This implies that transaction.commit() cannot have any affect on the transaction-threads associations the transaction may be participating in.

        The jta spec is notoriously bad and incomplete. More reasonable sources for information about xa are the x-open xa spec and the corba transaction spec, although the latter has quite a few non-xa features.

        Show
        djencks David Jencks added a comment - The paragraph you refer to describes the behavior of TransactionManager.commit(), not Transaction.commit() which was the subject of my comment. There is no doubt whatsoever that TransactionManager.commit() must remove any transaction-thread association. This paragraph does not specify anything about the behavior of Transaction.commit(). In section 3.3.3, Transaction.commit() is described briefly, and it's noted that the calling thread may have a different transaction association than the transaction it is calling commit on. This implies that transaction.commit() cannot have any affect on the transaction-threads associations the transaction may be participating in. The jta spec is notoriously bad and incomplete. More reasonable sources for information about xa are the x-open xa spec and the corba transaction spec, although the latter has quite a few non-xa features.
        Hide
        lorban Ludovic Orban added a comment -

        I disagree with your comment David.
        In the JTA 1.0.1 spec, page 10 paragraph 3.2.2 'Completing a Transaction' one can read: 'After the commit method returns, the calling thread is not associated with a transaction'. The same also applies to rollback.

        Show
        lorban Ludovic Orban added a comment - I disagree with your comment David. In the JTA 1.0.1 spec, page 10 paragraph 3.2.2 'Completing a Transaction' one can read: 'After the commit method returns, the calling thread is not associated with a transaction'. The same also applies to rollback.
        Hide
        djencks David Jencks added a comment -

        AFAIK this is correct behavior. tx.commit() is definitely supposed to leave the tx associated with the thread, and IIUC tm.begin() should fail even though the previous tx is complete.

        Show
        djencks David Jencks added a comment - AFAIK this is correct behavior. tx.commit() is definitely supposed to leave the tx associated with the thread, and IIUC tm.begin() should fail even though the previous tx is complete.

          People

          • Assignee:
            djencks David Jencks
            Reporter:
            dain Dain Sundstrom
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development