Overview | Returns an object that represents the transaction context currently associated with the current thread, and disassociates the currently associated transaction context from the current thread. |
Original interface | CosTransactions::Current Interface |
Intended Usage
If there is no current transaction, a NULL reference is returned.
This object can be given to the resume operation to reestablish this context in the same, or a different, thread within the same server process.
Syntax
Control suspend();
Input parameters
Return values
None.
Examples
The following examples demonstrate the usage of CosTransactions::Current::suspend.
C++ Example
#include <CosTransactions.hh> // CosTransactions module ... CosTransactions::Control_ptr control = NULL; ... //Access the CosTransactions::Current object. CORBA::Object_ptr orbCurrentPtr = CBSeriesGlobal::orb()->resolve_initial_references("TransactionCurrent"); CosTransactions::Current_ptr current = CosTransactions::Current::_narrow(orbCurrentPtr); ... // Invoke the begin operation on the CosTransactions::Current object. current->begin(); ... // Suspend the association between the transaction and the thread. control = current->suspend(); if (!control) { // There was no transaction associated with this thread prior to the // suspend. Perform appropriate action. cout << "Error: No transaction prior to suspend" << endl; }