Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / ImplRepo_Service / Locator_Loader.cpp
blob4a5f2e10eb054d00e5f57d679088f10962614c28
1 #include "orbsvcs/Log_Macros.h"
2 #include "Locator_Loader.h"
3 #include "ace/Dynamic_Service.h"
4 #include "ace/Task.h"
6 class ImR_Locator_ORB_Runner : public ACE_Task_Base
8 public:
9 ImR_Locator_ORB_Runner (ImR_Locator_Loader& service)
10 : service_ (service)
13 virtual int svc ()
15 // Block until service_.fini () calls orb->destroy ()
16 this->service_.run ();
17 return 0;
19 private:
20 ImR_Locator_Loader& service_;
23 ImR_Locator_Loader::ImR_Locator_Loader()
27 int
28 ImR_Locator_Loader::init (int argc, ACE_TCHAR *argv[])
30 try
32 int err = this->opts_.init (argc, argv);
33 if (err != 0)
34 return -1;
36 err = this->service_.init (this->opts_);
37 if (err != 0)
38 return -1;
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&)
47 return -1;
49 return 0;
52 int
53 ImR_Locator_Loader::fini ()
55 ACE_ASSERT(this->runner_.get () != 0);
56 try
58 int ret = this->service_.fini ();
60 this->runner_->wait ();
61 this->runner_.reset (0);
62 return ret;
64 catch (const CORBA::Exception&)
67 return -1;
70 CORBA::Object_ptr
71 ImR_Locator_Loader::create_object (CORBA::ORB_ptr,
72 int,
73 ACE_TCHAR**)
75 throw CORBA::NO_IMPLEMENT();
78 int
79 ImR_Locator_Loader::run()
81 try
83 return this->service_.run ();
85 catch (...)
87 ORBSVCS_ERROR((LM_ERROR, "Exception in ImR_Locator_ORB_Runner ()\n"));
88 return -1;
93 ACE_FACTORY_DEFINE (Locator, ImR_Locator_Loader)