What is a global transaction?

℡╲_俬逩灬. 提交于 2019-12-10 04:28:29

问题


JSR 907 JTA 1.2 defines the "global transaction" term:

The UserTransaction.begin method starts a global transaction and associates the transaction with the calling thread.

What does that mean? Is it the outermost transaction or what?


回答1:


Basically the difference between a local transaction and a global transaction is resource bound. A global transaction will span multiple resources. A local transaction is limited to one resource/datasource.

E.g.

In a global transaction you will write to the DB and send a message over a queue.

This is nicely explained here: http://integrationspot.blogspot.co.uk/2011/03/jta-transactions-local-and-global.html

Global Transactions (XA)

When a managed data source is configured for global transactions, it returns connections that can participate in global transactions. A global transaction (also called a distributed transaction) enlists more than one resource in the transaction.

Global Transactions provide the ability to work with multiple transactional resources (typically relational databases and message queues).



来源:https://stackoverflow.com/questions/27165900/what-is-a-global-transaction

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!