3.7.1.3.5 Description

The initialize callback method, which is invoked as the last step in server initialization, allows the application to perform application-specific initialization.

Typically, a server application does the following tasks in Server::initialize:

  • Creates references for CORBA object factories implemented in the server application and registers them with the FactoryFinder using the TP::register_factory() operation.
  • Initializes global variables, if any are used.
  • Opens XA resource managers if any are used by the server application.

It is the responsibility of the server application to open any required XA resource managers. This is done by invoking either of the following methods:

  • TP::open_xa_rm() This is the preferred technique for server applications, since it can be done on a static function, without the need to obtain an object reference.

    Note:

    You must use the TP::open_xa_rm() method if you use the INS bootstrap mechanism to obtain initial object references.
  • Tobj::TransactionCurrent::open_xa_rm() A reference to the TransactionCurrent object can be obtained from the Bootstrap object. For an explanation of how to obtain a reference to the Bootstrap object, see the section TP::bootstrap(). For more information about the TransactionCurrent object, see the CORBA Bootstrapping Programming Reference section and Using CORBA Transactions.
  • Transactions may be started in the initialize method after invoking the Tobj::TransactionCurrent::open_xa_rm() or TP::open_xa_rm method. However, any transactions that are started in initialize() must be terminated by the server application before initialize() returns. If the transactions are still active when control is returned, the server application fails to boot, and it exits gracefully. This happens because the server application has no logical way of either committing or rolling back the transaction after Server::initialize() returns. This condition is an error.