If a XAResource is the only resource involved in a Tx should the XAResource.prepare() be called
I am trying out a few things w/ JOTM and have some gene开发者_如何学JAVAral purpose questions regarding how things work. I have listed the sequence of events to get a definitive summary of what happens.
- create tx
- enlist resource
- tx.commit
- resource.start
- resource.end
- resource.commit
Why is resource.prepare never called and the flag to commit (onephase) is true. Is this the intended behaviour for such use cases ?
Why is resource.prepare never called and the flag to commit (onephase) is true
XA specification section 2.3.2:
One-phase Commit A TM can use one-phase commit if it knows that there is only one RM anywhere in the DTP system that is making changes to shared resources. In this optimisation, the TM makes its Phase 2 commit request without having made a Phase 1 prepare request.
Is this the intended behaviour for such use cases ?
yes
精彩评论