3.5.5 Releasing the CORBA Server Application

You require to include code in your CORBA server application to perform a graceful shutdown of the CORBA server application. The release()method is provided for that purpose. Within the release() method, you may perform any application-specific cleanup tasks that are specific to the CORBA server application, such as:

  • Unregistering object factories managed by the CORBA server application
  • Deallocating resources
  • Closing any databases
  • Closing an XA resource manager

Once a CORBA server application receives a request to shut down, the CORBA server application can no longer receive requests from other remote objects. This has implications on the order in which CORBA server applications should be shut down, which is an administrative task. For example, do not shut down one server process if a second server process contains an invocation in its release() method to the first server process.

During server shutdown, you may want to unregister each of the server application's factories. The invocation of the unregister_factory() method should be one of the first actions in the release() implementation. The unregister_factory() method unregisters the server application's factories. This operation requires the following input arguments:

  • The object reference for the factory
  • A string identifier, based on the factory object's interface typecode, used to identify the Interface Repository ID of the object's OMG IDL interface

The following code snippet includes C++ code that releases a server application and unregisters the factories in the CORBA server application.

...
public void release() {
                TP::unregister_factory(
                        factory_reference.in(),
                        SimpleFactoryHelper - > id
                );
        }
        ...