1 #include "orbsvcs/Log_Macros.h"
2 #include "Locator_Loader.h"
3 #include "ace/Dynamic_Service.h"
6 class ImR_Locator_ORB_Runner
: public ACE_Task_Base
9 ImR_Locator_ORB_Runner (ImR_Locator_Loader
& service
)
15 // Block until service_.fini () calls orb->destroy ()
16 this->service_
.run ();
20 ImR_Locator_Loader
& service_
;
23 ImR_Locator_Loader::ImR_Locator_Loader()
28 ImR_Locator_Loader::init (int argc
, ACE_TCHAR
*argv
[])
32 int err
= this->opts_
.init (argc
, argv
);
36 err
= this->service_
.init (this->opts_
);
40 // Create a thread in which to run the service
41 ACE_ASSERT(this->runner_
.get () == 0);
42 this->runner_
.reset(new ImR_Locator_ORB_Runner (*this));
43 this->runner_
->activate ();
45 catch (const CORBA::Exception
&)
53 ImR_Locator_Loader::fini ()
55 ACE_ASSERT(this->runner_
.get () != 0);
58 int ret
= this->service_
.fini ();
60 this->runner_
->wait ();
61 this->runner_
.reset (0);
64 catch (const CORBA::Exception
&)
71 ImR_Locator_Loader::create_object (CORBA::ORB_ptr
,
75 throw CORBA::NO_IMPLEMENT();
79 ImR_Locator_Loader::run()
83 return this->service_
.run ();
87 ORBSVCS_ERROR((LM_ERROR
, "Exception in ImR_Locator_ORB_Runner ()\n"));
93 ACE_FACTORY_DEFINE (Locator
, ImR_Locator_Loader
)