From: Anthony Geay Date: Fri, 10 Nov 2017 14:58:37 +0000 (+0100) Subject: Disable ORBsupportCurrent option for CORBA server to make the POAManager::hold_reques... X-Git-Tag: EMC2_V_1_0_2~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=afa0fcb751ec9d3bb0e7f09109846c94c8325744;p=modules%2Fkernel.git Disable ORBsupportCurrent option for CORBA server to make the POAManager::hold_requests work --- diff --git a/src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx b/src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx index 8cdad8fc6..cdbc5a75b 100644 --- a/src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx +++ b/src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx @@ -34,11 +34,19 @@ namespace SALOMESDS CORBA::Object_var activate() { PortableServer::POA_var poa(getPOA()); - PortableServer::ObjectId_var id(poa->activate_object(this)); + PortableServer::ObjectId_var id; + try + { + id=poa->activate_object(this); + } + catch(PortableServer::POA::ServantAlreadyActive& e) + { + id=poa->servant_to_id(this); + } CORBA::Object_var ret(poa->id_to_reference(id)); return ret; } - + void enforcedRelease() { PortableServer::POA_var poa(getPOA()); diff --git a/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx b/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx index 62d45fb0d..5045833bd 100644 --- a/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx +++ b/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx @@ -68,6 +68,8 @@ RequestSwitcher::RequestSwitcher(CORBA::ORB_ptr orb) threadPol->destroy(); PortableServer::POAManager_var mgr(_poa_for_request_control->the_POAManager()); mgr->activate(); + //obj=orb->resolve_initial_references ("POACurrent");// agy : usage of POACurrent breaks the hold_requests. Why ? + //PortableServer::Current_var current(PortableServer::Current::_narrow(obj)); } void RequestSwitcher::holdRequests() diff --git a/src/SALOMESDS/SALOME_DataScopeServer.cxx b/src/SALOMESDS/SALOME_DataScopeServer.cxx index f7daac616..077a0dddc 100644 --- a/src/SALOMESDS/SALOME_DataScopeServer.cxx +++ b/src/SALOMESDS/SALOME_DataScopeServer.cxx @@ -36,7 +36,18 @@ int main(int argc, char *argv[]) std::istringstream isTransacSS(argv[2]); int isTransac(0); isTransacSS >> isTransac; - CORBA::ORB_var orb(CORBA::ORB_init(argc,argv)); + CORBA::ORB_var orb; + { + int argc(3); + char **argv=new char *[3]; + char *p0(strdup("DTC")),*p1(strdup("-ORBsupportCurrent")),*p2(strdup("0")); + argv[0]=p0; + argv[1]=p1;// by disabling supportCurrent it make the POAManager::hold_requests work ! + argv[2]=p2; + orb=CORBA::ORB_init(argc,argv); + free(p0); free(p1); free(p2); + delete [] argv; + } CORBA::Object_var obj(orb->resolve_initial_references("RootPOA")); PortableServer::POA_var poa(PortableServer::POA::_narrow(obj)); PortableServer::POAManager_var mgr(poa->the_POAManager());