发帖    主题    评论    推荐    标签    作者    订阅    查搜    注册   登陆   关注
 
面向对象 设计模式 领域驱动设计 企业架构 框架 开发教程 微服务 大数据 扩展性 并发编程 事件驱动 分布式 SOA

不能理解 two-phase commit!

         
2004-04-20 12:42
赞助商链接

我知道:在JTA事务中,可能包括多个事务化资源,当JTA事务提交时,每个事务化资源会陆续提交.
问题:
当JTA事务提交时,第一个事务提交成功,第二个事务提交失败.这种情况JTA如何保证ACIP;

2004-04-21 02:03

Transaction Manager通知第一个事务回退到提交前的状态

2004-04-21 10:08

第一个事务成功提交后,还可以rollback吗??
在JTA的Transaction Manager接口中没声明此方法??

2004-04-21 11:52

第一阶段,并没有真正提交,而是所有参与者申明同意提交或者拒绝。只要有一个参与者拒绝,TM就会让其他同意提交的参与者滚回。


2.3 Transaction Completion and Recovery
TMs and RMs use two-phase commit with presumed rollback, as defined by the
referenced OSI DTP specification (model).
In Phase 1, the TM asks all RMs to prepare to commit (or prepare) transaction branches.
This asks whether the RM can guarantee its ability to commit the transaction branch.
An RM may have to query other entities internal to that RM.
If an RM can commit its work, it records stably the information it needs to do so, then
replies affirmatively. A negative reply reports failure for any reason. After making a
negative reply and rolling back its work, the RM can discard any knowledge it has of
the transaction branch.
In Phase 2, the TM issues all RMs an actual request to commit or roll back the
transaction branch, as the case may be. (Before issuing requests to commit, the TM
stably records the fact that it decided to commit, as well as a list of all involved RMs.)
All RMs commit or roll back changes to shared resources and then return status to the
TM. The TM can then discard its knowledge of the global transaction.
2.3.1 Rolling Back the Global Transaction
The TM rolls back the global transaction if any RM responds negatively to the Phase 1
request, or if the AP directs the TM to roll back the global transaction. Therefore, any
negative response vetoes the global transaction. A negative response concludes an
RM’s involvement in the global transaction.
The TM effects Phase 2 by telling all RMs to roll back transaction branches. They must
not let any changes to shared resources become permanent. The TM does not issue
Phase 2 requests to RMs that responded negatively in Phase 1. The TM does not need
to record stably the decision to roll back nor the participants in a rolled back global
transaction.

2004-04-22 09:31

谢谢楼上老兄的指点.

事务架构      JTA事务     

赞助商链接

赞助商链接

返回顶部

移动版 关于本站 使用帮助 联系管理员 最佳分辨率1366x768
OpenSource JIVEJDON Powered by JdonFramework Code © 2002-20 jdon.com