Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tao / PI_Server / PI_Server_Loader.cpp
blob3c38f5cf1fd7f1f309b1d5e5b35d1e7451a0d446
1 // -*- C++ -*-
2 #include "tao/PI_Server/PI_Server_Loader.h"
3 #include "tao/PI_Server/PortableServer_ORBInitializer.h"
5 #include "tao/debug.h"
6 #include "tao/ORB_Core.h"
7 #include "tao/ORBInitializer_Registry.h"
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
11 TAO_PI_Server_Loader::TAO_PI_Server_Loader ()
12 : initialized_ (false)
16 TAO_PI_Server_Loader::~TAO_PI_Server_Loader ()
20 int
21 TAO_PI_Server_Loader::init (int, ACE_TCHAR* [])
23 ACE_TRACE ("TAO_PI_Server_Loader::init");
25 // Only allow initialization once.
26 if (this->initialized_)
27 return 0;
29 this->initialized_ = true;
31 // Register the ORB initializer.
32 try
34 /// Register the Messaging ORBInitializer.
35 PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
36 PortableInterceptor::ORBInitializer::_nil ();
38 ACE_NEW_THROW_EX (temp_orb_initializer,
39 TAO_PortableServer_ORBInitializer,
40 CORBA::NO_MEMORY (
41 CORBA::SystemException::_tao_minor_code (
42 TAO::VMCID,
43 ENOMEM),
44 CORBA::COMPLETED_NO));
46 PortableInterceptor::ORBInitializer_var orb_initializer =
47 temp_orb_initializer;
49 PortableInterceptor::register_orb_initializer (orb_initializer.in ());
51 catch (const ::CORBA::Exception& ex)
53 ex._tao_print_exception ("Caught exception:");
54 return -1;
57 return 0;
61 /////////////////////////////////////////////////////////////////////
63 ACE_FACTORY_DEFINE (TAO_PI_Server, TAO_PI_Server_Loader)
64 ACE_STATIC_SVC_DEFINE (TAO_PI_Server_Loader,
65 ACE_TEXT ("PI_Server_Loader"),
66 ACE_SVC_OBJ_T,
67 &ACE_SVC_NAME (TAO_PI_Server_Loader),
68 ACE_Service_Type::DELETE_THIS
69 | ACE_Service_Type::DELETE_OBJ,
71 TAO_END_VERSIONED_NAMESPACE_DECL