• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two-phase commit in session 6.1.6 in EJB in Action (2nd edition)

 
Himai Minh
Ranch Hand
Posts: 1316
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In session 6.1.6, it says
quote 1:

In the first phrase, the transaction manager polls resource manager asking them if they are ready to commit. If all of the resource managers reply affirmatively, the transaction manager then issues a commit message to each resource manager. If any one of the resource managers responds negatively, the transaction is rolled back. Each resource manager is responsible for maintaining a transaction log....


quote 2:
In Figure 6.3, it shows phase 1 (voting phase),
each database reports back to the transaction manager that changes can be persisted. In phase 2 (commit phase), the transaction manager tells the individual database to commit.



In quote 1, the resource manager is involved. But in quote 2, there is no resource manager shown in the figure.
So, which statement is correct?

In my opinion, I think quote 2 is correct. The transaction manager interacts directly with the database, commit the changes or roll back to the original state.
If we use quote 1, the transaction manager has to interact with the resource manager, which takes longer time to commit or roll back. This may affect the performance.

 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here the resource managers are Databases systems, messaging systems and the likes. So it means the same thing I guess.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic