Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1836 Support multithreaded use of the transaction
  3. JBAS-1935

enlistResource should be ignored if resource is already enlisted

XMLWordPrintable

    • Compatibility/Configuration

      TransactionImpl.enlistResource()
      returns false if the XAResource is already enlisted.

      This is unclear in the spec:
      "enlistResource public boolean enlistResource(XAResource xaRes) throws RollbackException, IllegalStateException, SystemException Enlist the resource speci ed with the transaction associated with the target Transaction object. Parameters: xaRes The XAResource object associated with the resource (connection). Returns: true if the enlistment is successful; otherwise false."

      However, the OTS spec was clarified that duplicate enlistment should be left to the resources to decide
      whether duplicate processing was invalid.
      http://www.omg.org/issues/issue3600.txt

      Since we know the state of the enlistment in the transaction, we can avoid any duplicate enlistment
      (at least for non-distributed transactions) and return true. i.e. The resource is enlisted in the transaction.

      I am going to implement it this way unless the JTA spec is changed to say otherwise.
      Returning false just makes it look like an error occurred during the enlistment which it did,
      it was just already enlisted.
      This API is also bad design since there is no way to propagate the real exception to the caller,
      hence our warning logging of the XAException when one does occur during the XAResource.start().

            adrian.brock Adrian Brock (Inactive)
            adrian.brock Adrian Brock (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: