1 #include "orbsvcs/Log_Macros.h"
2 #include "Activator_Loader.h"
3 #include "ace/Dynamic_Service.h"
6 class ImR_Activator_ORB_Runner
: public ACE_Task_Base
8 ImR_Activator_Loader
& service_
;
10 ImR_Activator_ORB_Runner (ImR_Activator_Loader
& service
)
16 // Block until service_.fini() calls orb->destroy()
17 this->service_
.run ();
22 ImR_Activator_Loader::ImR_Activator_Loader ()
26 // For now, we will assume that it's sufficient to start
27 // the service in its own thread. Later, if necessary, we
28 // can add a command line option to allow the imr to use
29 // the same orb as other tao services, however the imr
30 // is currently written with the assumption that it's running
33 ImR_Activator_Loader::init (int argc
, ACE_TCHAR
*argv
[])
37 int err
= this->opts_
.init (argc
, argv
);
41 // Creates it's own internal orb, which we must run later
42 err
= this->service_
.init (this->opts_
);
46 // Create a thread in which to run the service
47 ACE_ASSERT (this->runner_
.get () == 0);
48 this->runner_
.reset (new ImR_Activator_ORB_Runner (*this));
49 this->runner_
->activate ();
51 catch (const CORBA::Exception
&)
59 ImR_Activator_Loader::fini ()
61 ACE_ASSERT (this->runner_
.get() != 0);
64 int ret
= this->service_
.fini ();
66 this->runner_
->wait ();
67 this->runner_
.reset (0);
70 catch (const CORBA::Exception
&)
77 ImR_Activator_Loader::create_object (CORBA::ORB_ptr
,
81 throw CORBA::NO_IMPLEMENT ();
85 ImR_Activator_Loader::run ()
89 return this->service_
.run ();
93 ORBSVCS_ERROR ((LM_ERROR
, "Exception in ImR_Locator_ORB_Runner()\n"));
98 ACE_FACTORY_DEFINE (Activator
, ImR_Activator_Loader
)