3.3.7 Voting on Transaction Outcome
CORBA objects can affect transaction outcome during two stages of transaction processing:
- During transactional work
The
Current.rollback_only
method can be used to ensure that the only possible outcome is to roll back the current transaction.Current.rollback_only()
can be invoked from any CORBA object method. - After completion of transactional work
CORBA objects that have the transaction activation policy are given a chance to vote whether the transaction should commit or roll back after transactional work is completed. These objects are notified of the completion of transactional work prior to the start of the two-phase commit algorithm when the TP Framework invokes their
deactivate_object
method.This behavior does not apply to objects with
process
ormethod
activation policies. If the CORBA object wants to roll back the transaction, it can callCurrent::rollback_only
. If it wants to vote to commit the transaction, it does not make that call. Note, however, that a vote to commit does not guarantee that the transaction is committed, since other objects may subsequently vote to roll back the transaction.
Note:
Users of SQL cursors must be careful when using an object with themethod
or process
activation policy. A process opens an SQL cursor within a client-initiated transaction. For typical SQL database products, once the client commits the transaction, all cursors that were opened within that transaction are automatically closed; however, the object will not receive any notification that its cursor has been closed.
Parent topic: Transactions