]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Disable ORBsupportCurrent option for CORBA server to make the POAManager::hold_reques...
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 10 Nov 2017 14:58:37 +0000 (15:58 +0100)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 23 Jan 2018 15:48:15 +0000 (16:48 +0100)
src/SALOMESDS/SALOMESDS_AutoRefCountPtr.hxx
src/SALOMESDS/SALOMESDS_DataScopeServer.cxx
src/SALOMESDS/SALOME_DataScopeServer.cxx

index 8cdad8fc64aa778ac5648a0343747aa8024c6335..cdbc5a75bd5c62c7b2bafc93d2e542d4da9a9dc7 100644 (file)
@@ -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());
index 62d45fb0deaf4a643d52cdc4fece2abcb2ecd983..5045833bd60176cd837fe50f546813762e2895ac 100644 (file)
@@ -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()
index f7daac616a8de5503be6b51bf86a601accb634fe..077a0dddc2926e6266dec2237f888eb21873132f 100644 (file)
@@ -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());