[Enterprise Extensions only]

Current::get_control

Overview Returns an object representing the transaction context currently associated with the current thread.
Original interface CosTransactions::Current Interface


Intended Usage

If the current thread is not associated with a transaction, a NULL object reference is returned.

The Control object returned can be given to the Current::resume Operation to reestablish this transaction context in the same thread or a different thread.

IDL Syntax

  Control get_control();

Input parameters

None.

Return values

Control
Represents the transaction context currently associated with the current thread. The caller should not free the returned object; the Transaction Service retains ownership of it.

Examples

The following examples demonstrate the usage of CosTransactions::Current::get_control.

C++ Example

#include <CosTransactions.hh>
{
   CosTransactions::Current_ptr my_current;
   CosTransactions::Control_ptr control;
   ...
   // Access the CosTransactions::Current object.
   CORBA::Object_ptr orbCurrentPtr = 
     CBSeriesGlobal::orb()->resolve_initial_references("TransactionCurrent");
   my_current = CosTransactions::Current::_narrow(orbCurrentPtr);
   control = my_current->get_control();
   ...
}
 

Java Example

import org.omg.CosTransactions.*;
{
   org.omg.CosTransactions.Current my_current;
   org.omg.CosTransactions.Control control;
   ...
   // Access the org.omg.CosTransactions.Current object.
   org.omg.CORBA.Object orbCurrentPtr =
     com.ibm.CBCUtil.CBSeriesGlobal.orb().resolve_initial_references(
        "TransactionCurrent");
   my_current = org.omg.CosTransactions.CurrentHelper.narrow(orbCurrentPtr);
   control = my_current.get_control();
   ...
}