Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create servants of difference type using incarnate method.

0 views
Skip to first unread message

Amit

unread,
Nov 13, 2009, 1:13:48 AM11/13/09
to
Hello Friends,

I am using Servant Activator for my poa. I have implemented
ServantActivator::incarnate() method to create a new servant of a
specific type from heap. I am using create_reference() method to
create an object reference of a particular type before making any
call.
My problem: Let there are two interfaces A and B. I need to create a
servant of either of thees two types (A or B) on need basis at run
time. But I don't know how to do it within incarnate method as I don't
know the type of the object reference being referred by oid parameter
of incarnate method. Is there any way to perform this?

I tried a logic given below but it failed due to poa->id_to_reference
() method with the following error:
12 [sig] server 504 _cygtls::handle_exceptions: Error
while dumping state
probably corrupted stack)

Piece of code:

PortableServer::Servant incarnate( const PortableServer::ObjectId &
oid,

PortableServer::POA_ptr poa )
{
PortableServer::Servant servant= 0;
CORBA::Object_var obj= poa->id_to_reference(oid);
Example_var ex=
Example::_narrow(obj.in());
if (!CORBA::is_nil(nC))
{
servant= new Example_i(poa);
}
return servant;
}
}

Any help would be highly appreciated.

Regards,
Amit

Amit

unread,
Nov 13, 2009, 1:16:25 AM11/13/09
to
Note: Subject line modified.
0 new messages