Transaction managers

The transaction manager is responsible the coordination of transactions across one or more resources. This guarantees the completion of each transaction and decides whether to commit or rollback. Its main responsibilities are as follows:

  • Starting and ending (with commit or abort state) transactions, using the begin, commit, and rollback methods
  • Coordinating the transactions across multiple resources
  • Managing the transaction context—the transaction manager creates it and attaches it to the current thread
  •  Recovery from failure—this concept is implemented by using rollback capabilities that ensure the recovery of the original data state caused by a failure

There are two types of transaction managers, local and global:

  • The local transaction manager is responsible for coordinating the transactions over a single resource; it's not able to provide ACID features across multiple resources (for example, database updates and Java Message Service (JMS) message sending).
  • The global transaction manager is used to coordinate transactions over multiple resources. Usually, it's provided by an external system (for example an application server) and it's able to guarantee ACID transactions between two or more different transactional resources.

Transaction managers are defined in Java EE/Jakarta EE through two specifications:

  • Java Transaction API (JTA), currently in version 1.2
  • Java Transaction Service (JTS)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset