3 #include "MPIContainer_i.hxx"
4 #include "Utils_ORB_INIT.hxx"
5 #include "Utils_SINGLETON.hxx"
7 #include "SALOMETraceCollector.hxx"
10 int main(int argc, char* argv[])
13 Engines_MPIContainer_i * myContainer=NULL;
15 MPI_Init(&argc,&argv);
16 MPI_Comm_size(MPI_COMM_WORLD,&nbproc);
17 MPI_Comm_rank(MPI_COMM_WORLD,&numproc);
19 // Initialise the ORB.
20 ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
21 CORBA::ORB_var &orb = init( argc , argv ) ;
22 // SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
24 BEGIN_OF("[" << numproc << "] " << argv[0])
27 // Obtain a reference to the root POA.
28 CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
29 PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
31 // obtain the root poa manager
32 PortableServer::POAManager_var pman = root_poa->the_POAManager();
34 // define policy objects
35 PortableServer::ImplicitActivationPolicy_var implicitActivation =
36 root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
38 // default = NO_IMPLICIT_ACTIVATION
39 PortableServer::ThreadPolicy_var threadPolicy =
40 root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
41 // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
44 CORBA::PolicyList policyList;
46 policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
47 policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
49 // create the child POA
50 PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
51 PortableServer::POA_var factory_poa =
52 root_poa->create_POA("factory_poa", pman, policyList) ;
53 //with nil_mgr instead of pman, a new POA manager is created with the new POA
55 // destroy policy objects
56 implicitActivation->destroy() ;
57 threadPolicy->destroy() ;
59 char *containerName = "";
62 containerName = argv[1] ;
65 MESSAGE("[" << numproc << "] MPIContainer: load MPIContainer servant");
66 myContainer = new Engines_MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName,argc,argv);
73 catch(CORBA::SystemException&){
74 INFOS("Caught CORBA::SystemException.");
76 catch(PortableServer::POA::WrongPolicy&){
77 INFOS("Caught CORBA::WrongPolicyException.");
79 catch(PortableServer::POA::ServantAlreadyActive&){
80 INFOS("Caught CORBA::ServantAlreadyActiveException");
82 catch(CORBA::Exception&){
83 INFOS("Caught CORBA::Exception.");
86 INFOS("Caught unknown exception.");
92 END_OF("[" << numproc << "] " << argv[0]);
93 // delete myThreadTrace;