The Transaction class provides in interface to the transaction functions of the BEA TUXEDO ATMI.
BEATuxBldr · Transaction
Transaction provides member functions that perform all transaction-related operations. By incorporating these operations into Transaction, ATMI transaction error codes are integrated into the exception handling structure of the application. Transaction objects are pseudo-objects, used solely to access the operations in the class. Transaction is very similar to CosTransactions::Current in the BEA TUXEDO Builder Active Expert.
Transaction pseudo-objects are instantiated using this constructor:
void Transaction::begin() throw(NoTransaction*,
SubtransactionsUnavailable*);
An application should create a Transaction object when it needs to perform transaction demarcation operations. This class is used for transactions the application explicitly originates and for implicit, on-going global transactions that the application participates in.
The TX transaction processing API functions tx_open and tx_close are not represented in this class. They should be implemented in the open_xa_rm and close_xa_rm member functions of Server.
This section lists the data types of Transaction class
| Data Type | Access | Documented in |
|---|---|---|
|
Status |
public |
Transaction |
Status
Description
Status is an enumerated type that indicates the status of a transaction. Valid values for Status are:
Use This section lists the member functions of GetInvoke to determine the current value of InvocationType, and SetInvoke to specify a new value.
Member Functions
Transaction.
begin
begin starts a global transaction on behalf of the caller.
Synopsis
void begin() throw(NoTransaction*, SubtransactionsUnavailable*)
Throws
SubtransactionsUnavailable*
SubtransactionsUnavailable exception is thrown if an attempt is made to start a nested transaction. Nested transactions are not supported, as BEA TUXEDO does not currently support them.
commit uses the two-phase commit protocol to commit the active transaction.
void commit(Boolean reportHeuristics) throw(NoTransaction*,
HeuristicMixed*, HeuristicException*)
TRUE, the function returns only after the second phase of two-phase commit protocol has been completed.FALSE, the operation returns after the commit decision has been logged, but before the second phase has been completed.
HeuristicHazard*
HeuristicMixed*
NoTransaction*
get_status returns value of Status, which indicates the status of a transaction.
Status get_status()
resume is used to resume work on behalf of the active transaction.
void resume(Control*) throw (InvalidControl*)
Control*
Control is the pseudo-object returned by a previous suspend. There is no effect if resume is passed a NULL Control object.
InvalidControl*
resume is passed an invalid Control object.
The only valid Control object that can be passed to resume is one obtained by a prior call to the suspend function.
rollback aborts the current active transaction.
void rollback(void) throw(NoTransaction*)
NoTransaction*
NoTransaction exception is thrown if there is no active transaction.
Note:
This member function is identical to rollback_only.
rollback_only aborts the current active transaction.
void rollback_only(void) throw (NoTransaction*)
NoTransaction*
NoTransaction exception is thrown if there is no active transaction.
Note:
This member function is identical to rollback.
set_timeout sets the time-out period for subsequent transactions.
void set_timeout(unsigned long seconds) throw()
This function can be invoked to establish the time-out value for the next transaction started with begin.
suspend is used to suspend work on behalf of the active transaction.
Control* suspend()
Control*
Control pseudo-object is used by resume to reactivate the transaction.
Operations performed after suspend is invoked are not included in the active transaction. Use resume to include further operations in the active transaction.
The suspend member function returns a Control if there is an active transaction. If there is no active transaction, it returns a NULL object reference.
Instantiates a Transaction pseudo-object.
Transaction()
A client or server application must have a reference to a Transaction pseudo-object before it can use any of the other member functions of this class.