The X/Open XA
interface specifies that the transaction-association-related xa
calls must be invoked from the same thread context. This thread-of-control requirement does not apply to the object-oriented component-based application run-time environment, in which application threads are dispatched dynamically as methods are invoked.. Different threads may use the same connection resource to access the resource manager if the connection spans multiple method invocation. Depending on the implementation of the application server, different threads may be involved with the same XAResource
object. The resource context and the transaction context operate independent of thread context. This creates the possibility of different threads invoking the start
and end
methods.
If the application server allows multiple threads to use a single XAResource
object and the associated connection to the resource manager, the application server must ensure that only one transaction context is associated with the resource at any point of time. Thus the XAResource
interface requires the resource managers to support the two-phase commit protocol from any thread context.