What Does Transaction Manager Mean?
A transaction manager is a part of an application that controls the coordination of transactions over one or more resources. The transaction manager is responsible for creating transaction objects and managing their durability and atomicity. Transaction managers keep track of all the resource managers that are enlisted in a transaction.
Techopedia Explains Transaction Manager
When instructed to commit a transaction, transaction managers kick off the two-phase commit protocol. In the first phase, they ask all enlisted resource managers to prepare. In the second phase, the transaction managers notify the resource managers if the transaction is aborted or committed.
A transaction manager maintains a log in storage. This log is usually a sequential file, which is used to record the transaction events. Transaction managers use this log for recording transaction starts, commit decisions, enlistments, etc. At the time of normal processing, transaction managers simply write to the log, but if they fail, they read the log as soon as it restarts to restore the latest state.
Transaction managers often have the following responsibilities:
- Demarcation: Starting and finishing transactions by means of begin, commit and rollback methods.
- Controlling the Transaction Context: Transaction contexts contain all the information that helps a transaction manager to monitor a transaction. Transaction managers are in charge of building transaction contexts and connecting them to the existing thread.
- Coordinating the Transaction: Transaction managers generally have the ability to harmonize a transaction over various resources. This feature demands the two-phase commit protocol. XA protocol is also used to register and manage the resources.
- Recovery From Failure: Transaction managers are accountable to guarantee that the resources are not kept in an inconsistent state in case of a system or application failure.