[omniORB] Main Thread Mode - POA Questions
scott.rediger at teradyne.com
scott.rediger at teradyne.com
Thu Nov 13 08:03:12 GMT 2003
Craig,
I had the same issue with needing a non-reentrant CORBA server. You just
need to create a new POA as a child of the root POA (under the same
POAManager), whith a policy of PortableServer::SINGLE_THREAD_MODEL. If
you don't have it, you should get the "Advanced CORBA Programming with
C++" book by Henning and Vinoski - it goes through all of this in
detail. Below is what I would have had to add to your code to make our
app work:
>orb_ = CORBA::ORB_init(argc, argv, "omniORB4");
>CORBA::Object_var obj = orb_->resolve_initial_references("RootPOA");
>poa_ = PortableServer::POA::_narrow(obj);
>PortableServer::POAManager_var pman = poa_->the_POAManager();
CORBA::PolicyList pl;
pl.length(1);
pl[0] =
root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL);
PortableServer::POA_var my_poa = root_poa->create_POA("myPOA", pman,
pl);
// activate our object in the new POA
MyObject_var my_obj = new MyObjectServant();
PortableServer::ObjectID_var myObjID = my_poa->activate_object(my_obj)
>pman->activate();
Hope this helps,
Scott Rediger
More information about the omniORB-list
mailing list