{
void shutdown();
};
-
- interface RequestSwitcher
+
+ interface RequestSwitcherBase
{
void holdRequests();
void activeRequests();
+ };
+
+ interface RequestSwitcher : RequestSwitcherBase
+ {
StringVec listVars();
ByteVec fetchSerializedContent(in string varName) raises (SALOME::SALOME_Exception);
};
PortableServer::POA_var root_poa;
PortableServer::POAManager_var pman;
CORBA::Object_var obj;
-
- CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
+ CORBA::ORB_var orb;
+ {
+ int myArgc(argc+2);
+ char **myArgv(new char *[myArgc]);
+ for(int i=0;i<argc;i++)
+ myArgv[i]=strdup(argv[i]);
+ myArgv[argc+0]=strdup("-ORBsupportCurrent");
+ myArgv[argc+1]=strdup("0");
+ orb = CORBA::ORB_init( myArgc , myArgv ) ;
+ for(int i=0;i<myArgc;i++)
+ free(myArgv[i]);
+ delete [] myArgv;
+ }
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
INFOS_COMPILATION;
BEGIN_OF(argv[0]);
SALOMESDS_RefCountServ.cxx
SALOMESDS_BasicDataServer.cxx
SALOMESDS_DataScopeServer.cxx
+ SALOMESDS_RequestSwitcher.cxx
SALOMESDS_DataServerManager.cxx
SALOMESDS_PickelizedPyObjServer.cxx
SALOMESDS_PickelizedPyObjRdOnlyServer.cxx
_orb->shutdown(0);
}
-RequestSwitcher::RequestSwitcher(CORBA::ORB_ptr orb, DataScopeServerBase *ds):_ds(ds)
+RequestSwitcher::RequestSwitcher(CORBA::ORB_ptr orb, DataScopeServerBase *ds):RequestSwitcherBase(orb),_ds(ds)
{
- CORBA::Object_var obj(orb->resolve_initial_references("RootPOA"));
- PortableServer::POA_var poa(PortableServer::POA::_narrow(obj));
- _poa_manager_under_control=poa->the_POAManager();
- //
- CORBA::PolicyList policies;
- policies.length(1);
- PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
- policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol);
- // all is in PortableServer::POAManager::_nil. By specifying _nil cf Advanced CORBA Programming with C++ p 506
- // a new POA manager is created. This POA manager is independant from POA manager of the son ones.
- _poa_for_request_control=poa->create_POA("4RqstSwitcher",PortableServer::POAManager::_nil(),policies);
- 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()
-{
- _poa_manager_under_control->hold_requests(true);
-}
-
-void RequestSwitcher::activeRequests()
-{
- _poa_manager_under_control->activate();
}
SALOME::StringVec *RequestSwitcher::listVars()
KeyWaiter *retc(dynamic_cast<KeyWaiter *>(ret));
if(!retc)
throw Exception("DataScopeServerTransaction::invokeMonoThr : internal error 1 !");
- retc->_remove_ref();// restore the counter afer _poa_for_key_waiter->reference_to_servant(kw)
+ retc->_remove_ref();// restore the counter after _poa_for_key_waiter->reference_to_servant(kw)
SALOME::ByteVec *zeRet(retc->waitForMonoThr());
retc->enforcedRelease();
return zeRet;
KeyWaiter *retc(dynamic_cast<KeyWaiter *>(ret));
if(!retc)
throw Exception("DataScopeServerTransaction::invokeMonoThr : internal error 1 !");
- retc->_remove_ref();// restore the counter afer _poa_for_key_waiter->reference_to_servant(kw)
+ retc->_remove_ref();// restore the counter after _poa_for_key_waiter->reference_to_servant(kw)
SALOME::ByteVec *zeRet(retc->waitForAndKill());
retc->enforcedRelease();
return zeRet;
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SALOME_SDS)
+#include "SALOMESDS_RequestSwitcher.hxx"
#include "SALOMESDS_RefCountServ.hxx"
#include "SALOMESDS_AutoRefCountPtr.hxx"
#include "SALOMESDS_BasicDataServer.hxx"
};
class DataScopeServerBase;
-
+
/*!
* Servant activated by a specific POA (single thread) having itself its specific POA_manager.
* This class is able to hold/active the default POA_manager shared by other POA than this.
*/
- class SALOMESDS_EXPORT RequestSwitcher : public POA_SALOME::RequestSwitcher, public POAHolder
+ class SALOMESDS_EXPORT RequestSwitcher : public RequestSwitcherBase, public virtual POA_SALOME::RequestSwitcher
{
public:
RequestSwitcher(CORBA::ORB_ptr orb, DataScopeServerBase *ds);
- void holdRequests();
- void activeRequests();
SALOME::StringVec *listVars();
SALOME::ByteVec *fetchSerializedContent(const char *varName);
- PortableServer::POA_var getPOA() const { return _poa_for_request_control; }
private:
- PortableServer::POA_var _poa_for_request_control;
- PortableServer::POAManager_var _poa_manager_under_control;
//! handle on its creator to give access to services when _poa_manager_under_control is in hold mode.
DataScopeServerBase *_ds;
};
policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol);
_poa=poa->create_POA("SingleThPOA4SDS",pman,policies);
threadPol->destroy();
+ //An another _poa_for_request_control to give to my boss the pure power
+ {
+ CORBA::PolicyList policies;
+ policies.length(1);
+ PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+ policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol);
+ // all is in PortableServer::POAManager::_nil. By specifying _nil cf Advanced CORBA Programming with C++ p 506
+ // a new POA manager is created. This POA manager is independent from POA manager of the son ones.
+ _poa_for_request_control=poa->create_POA("4RqstSwitcher",PortableServer::POAManager::_nil(),policies);
+ threadPol->destroy();
+ PortableServer::POAManager_var mgr(_poa_for_request_control->the_POAManager());
+ mgr->activate();
+ }
//
dftScope->initializePython(argc,argv);// agy : Very important ! invoke this method BEFORE activation !
// activate this to be ready to be usable from NS.
CORBA::ORB_var _orb;
//! single thread poa
PortableServer::POA_var _poa;
+ //! single thread poa and with a specific poa_manager
+ PortableServer::POA_var _poa_for_request_control;
};
}
--- /dev/null
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony GEAY (EDF R&D)
+
+#include "SALOMESDS_RequestSwitcher.hxx"
+
+using namespace SALOMESDS;
+
+RequestSwitcherBase::RequestSwitcherBase(CORBA::ORB_ptr orb)
+{
+ CORBA::Object_var obj(orb->resolve_initial_references("RootPOA"));
+ PortableServer::POA_var poa(PortableServer::POA::_narrow(obj));
+ _poa_manager_under_control=poa->the_POAManager();
+ //
+ CORBA::PolicyList policies;
+ policies.length(1);
+ PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+ policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol);
+ // all is in PortableServer::POAManager::_nil. By specifying _nil cf Advanced CORBA Programming with C++ p 506
+ // a new POA manager is created. This POA manager is independent from POA manager of the son ones.
+ _poa_for_request_control=poa->create_POA("4RqstSwitcher",PortableServer::POAManager::_nil(),policies);
+ 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 RequestSwitcherBase::holdRequests()
+{
+ _poa_manager_under_control->hold_requests(true);
+}
+
+void RequestSwitcherBase::activeRequests()
+{
+ _poa_manager_under_control->activate();
+}
--- /dev/null
+// Copyright (C) 2018 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony GEAY (EDF R&D)
+
+#ifndef __SALOMESDS_REQUESTSWITCHER_HXX__
+#define __SALOMESDS_REQUESTSWITCHER_HXX__
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SALOME_SDS)
+#include "SALOMESDS_AutoRefCountPtr.hxx"
+#include "SALOMESDS_Defines.hxx"
+
+namespace SALOMESDS
+{
+ /*!
+ * Servant activated by a specific POA (single thread) having itself its specific POA_manager.
+ * This class is able to hold/active the default POA_manager shared by other POA than this.
+ */
+ class SALOMESDS_EXPORT RequestSwitcherBase : public virtual POA_SALOME::RequestSwitcherBase, public POAHolder
+ {
+ public:
+ RequestSwitcherBase(CORBA::ORB_ptr orb);
+ void holdRequests();
+ void activeRequests();
+ PortableServer::POA_var getPOA() const { return _poa_for_request_control; }
+ private:
+ PortableServer::POA_var _poa_for_request_control;
+ PortableServer::POAManager_var _poa_manager_under_control;
+ };
+}
+
+#endif