Export (0) Print
Expand All

How Application Program Transactions Commit and Abort

This section describes how transactions commit and abort for application programs.

Transaction Commit

Only the application program that called BeginTransaction can call Commit. No other participant in the transaction can commit the transaction.

An application program should not call Commit while a resource manager operation is outstanding for the transaction. An application program that invokes asynchronous operations must wait for all asynchronous operations to complete before committing the transaction. An application program that violates this rule runs the risk of committing the transaction prematurely, and the DTC does nothing to prevent transactions from committing prematurely.

Resource managers must be capable of handling premature commit requests. If a resource manager receives a commit request while doing work on behalf of a transaction, it can either abort the transaction or complete the request before committing the transaction.

Transaction Abort

Any participant in the transaction can abort the transaction. The transaction initiator can abort the transaction at any time by calling Abort, as long as it has not called Commit. Any resource manager enlisted in the transaction can abort the transaction by calling Abort any time before responding prepared" at phase one of the two-phase commit protocol. A resource manager can also abort the transaction at phase one of the two-phase commit protocol by responding E_FAIL to the prepare request from the transaction manager.

See Also

Show:
© 2014 Microsoft