[Enterprise Extensions only]

Current::set_timeout

Overview Sets the timeout value to be used for all subsequent transactions.
Original interface CosTransactions::Current Interface
Exceptions INITIALIZE standard exception


Intended Usage

Subsequent transactions created are subject to being rolled back if they do not complete within the time limit specified on this parameter. The default value for the time limit is platform dependent. If the parameter is zero, there is no application-specific time limit.

The INITIALIZE standard exception is raised if set_timeout is being used for the first time and the Transaction Service cannot be initialized.

IDL Syntax

  void set_timeout(in unsigned long seconds);

Input parameters

seconds
The value of the time limit in seconds.

Return values

None.

Examples

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

C++ Example

  #include <CosTransactions.hh> // CosTransactions module
  ...
  //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 set_timeout operation on the CosTransactions::Current object.
  current->set_timeout(60 /* seconds */);
  ...
  // Start a transaction
  ...

Java Example

  import org.omg.CosTransactions.*; // CosTransactions module
  ...
  //Access the org.omg.CosTransactions.Current object.
  org.omg.CORBA.Object orbCurrentPtr =
     com.ibm.CBCUtil.CBSeriesGlobal.orb().resolve_initial_references(
        "TransactionCurrent");
  org.omg.CosTransactions.Current current =
     org.omg.CosTransactions.CurrentHelper.narrow(orbCurrentPtr);
  // Invoke the set_timeout operation on the org.omg.CosTransactions.Current 
  // object.
  current.set_timeout(60 /* seconds */);
  ...
  // Start a transaction
  ...