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 theTP::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 theTobj::TransactionCurrent::open_xa_rm()
orTP::open_xa_rm
method. However, any transactions that are started ininitialize()
must be terminated by the server application beforeinitialize()
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 afterServer::initialize()
returns. This condition is an error.
Parent topic: Server::initialize()