Skip navigation.

CORBA Programming Reference

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

 


Server::release()

Synopsis

Allows the application to perform any application-specific cleanup, such as logging off a database, unregistering well-known factories, or deallocating resources.

C++ Binding

typedef Tobj_ServantBase* Tobj_Servant;
class Server {
public:
void release();
};

Arguments

None.

Exceptions

If an exception is raised in release(), the TP Framework catches the exception. Each exception causes an error message to be written to the user log (ULOG) file, as follows:

TobjS::ReleaseFailed

"TPFW_CAT:2: WARN: Exception in Server::release(): IDL:beasys.com/TobjS/ReleaseFailed:1.0. Reason = reason"

Where reason is a string supplied by application code. For example:

Throw TobjS::ReleaseFailed(
"Couldn't unregister factory");

CORBA::Exception

"TPFW_CAT:2: WARN: Exception in Server::release(): exception. Reason = unknown"

Where exception is the interface ID of the CORBA exception that was raised.

Other Exceptions

"TPFW_CAT:2: WARN: Exception in Server::release(): unknown exception. Reason = unknown"

In all cases, the server continues to exit.

Description

The release callback method, which is invoked as the first step in server shutdown, allows the server application to perform any application-specific cleanup. The user must override the virtual function definition.

Typical tasks performed by the application in this method are as follows:

This method is normally called in response to a tmshutdown command from the administrator or operator.

The TP Framework provides a default implementation of Server::release(). The default implementation closes XA resource managers for the server. The implementation does this by issuing a tx_close() invocation, which uses the default CLOSEINFO configured for the server's group in the UBBCONFIG file.

It is the responsibility of the application to close any open XA resource managers. This is done by issuing either of the following calls:

Note: You must use the TP::close_xa_rm() method if you use the INS bootstrap mechanism to obtain initial object references.

Note: Once a server receives a request from the tmshutdown(1) command to shut down, it can no longer receive requests from other remote objects. This may require servers to be shut down in a specific order. For example, if the Server::release() method in Server 1 needs to access a method of an object that resides in Server 2, Server 2 should be shut down after Sever 1 is shut down. In particular, the TP::unregister_factory() method accesses the FactoryFinder Registrar object that resides in a separate server. The TP::unregister_factory() method is typically invoked from the release() method; therefore, the FactoryFinder server should be shut down after all servers that call TP::unregister_factory() in their Server::release() method.

Return Value

None.

 

Skip navigation bar  Back to Top Previous Next