-
Sub-task
-
Resolution: Done
-
Major
-
JBossAS-4.0.2 Final
-
None
-
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().