3.7.1.2.7.4 Description
The TP Framework invokes the create_servant_with_id
method when a request arrives at the server and there no servant is
available to satisfy the request. The TP Framework passes in the
interface name for the servant to be created and the object ID
associated with the object with which the servant will be
associated. The server application instantiates an appropriate C++
object and returns a pointer to it. Typically, the method contains
a switch
statement on the interface name and creates a
new object, depending on the interface name. Providing the object
ID allows a servant implementation to make decisions during the
creation of the servant instance that require knowledge of the
target object. Reentrancy support is one example of how a servant
implementation might employ knowledge of the target object.
The ServerBase
class provides a default
implementation of create_servant_with_id
which calls
the standard create_servant
method passing the
interface name. This default implementation ignores the target
object ID parameter.
Caution:
The server application must not depend on the invocation of this method for every activation of a CORBA object. The server application must not handle the CORBA object state in the constructors or destructors of any servant classes for CORBA objects. This is because the TP Framework might reuse servants on activation and might not destroy servants on deactivation.Parent topic: ServerBase::create_servant_with_id()