CORBA Programming Reference
|
|
Explicitly activates an individual object.
ObjectId * activate_object (
Servant p_servant);
If the specified servant is already in the Active Object Map, the ServantAlreadyActive exception is raised.
Note: Other exceptions can occur if the POA uses unsupported policies.
This operation explicitly activates an individual object by generating an ObjectId and entering the ObjectId and the specified servant in the Active Object Map.
Note: This function is supported only for a joint client/server.
If the function succeeds, the ObjectId is returned.
In the following example, the first struct creates a servant by a user-defined constructor. The second struct tells the POA that the servant can be used to handle requests on an object. The POA returns the ObjectId it has created for the object. The third statement assumes that the POA has the IMPLICIT_ACTIVATION policy (the only supported policy in version 4.2 of the BEA Tuxedo software) and returns a reference to the object. That reference can then be handed to a client for invocations. When the client invokes on the reference, the request is returned to the servant just created.
MyFooServant* afoo = new MyFooServant(poa,27);
PortableServer::ObjectId_var oid =
poa->activate_object(afoo);
Foo_var foo = afoo->_this();
|
|
|