Locator_NT_Service Class Reference

Allows the Implementation Repository to act as a Windows NT Service. More...

#include <Locator_NT_Service.h>

List of all members.

Public Types

typedef TAO_SYNCH_RECURSIVE_MUTEX MUTEX

Public Member Functions

virtual void handle_control (DWORD control_code)
virtual int handle_exception (ACE_HANDLE h)
virtual int svc (void)
 This is a virtual method inherited from ACE_NT_Service.


Friends

class ACE_Singleton< Locator_NT_Service, MUTEX >


Detailed Description

Allows the Implementation Repository to act as a Windows NT Service.

Definition at line 36 of file Locator_NT_Service.h.


Member Typedef Documentation

typedef TAO_SYNCH_RECURSIVE_MUTEX Locator_NT_Service::MUTEX
 

Definition at line 39 of file Locator_NT_Service.h.


Member Function Documentation

void Locator_NT_Service::handle_control DWORD  control_code  )  [virtual]
 

We override because it handles stop requests privately.

Definition at line 31 of file Locator_NT_Service.cpp.

References ACE_Reactor::end_reactor_event_loop(), TAO_ORB_Core::orb(), TAO_ORB_Core::reactor(), and TAO_ORB_Core_instance().

00032 {
00033   if (control_code == SERVICE_CONTROL_SHUTDOWN
00034       || control_code == SERVICE_CONTROL_STOP)
00035     {
00036       report_status (SERVICE_STOP_PENDING);
00037       TAO_ORB_Core_instance ()->reactor ()->end_reactor_event_loop ();
00038       TAO_ORB_Core_instance ()->orb ()->shutdown (1);
00039     }
00040   else
00041     {
00042       ACE_NT_Service::handle_control (control_code);
00043     }
00044 }

int Locator_NT_Service::handle_exception ACE_HANDLE  h  )  [virtual]
 

We override so a 'stop' control code can wake the reactor off of its wait.

Definition at line 50 of file Locator_NT_Service.cpp.

00051 {
00052   return 0;
00053 }

int Locator_NT_Service::svc void   )  [virtual]
 

This is a virtual method inherited from ACE_NT_Service.

We do almost the same thing as we do in run_standalone ()

Definition at line 60 of file Locator_NT_Service.cpp.

References ImR_Locator_i::fini(), ImR_Locator_i::init(), Options::init_from_registry(), and ImR_Locator_i::run().

00061 {
00062   ImR_Locator_i server;
00063   Options opts;
00064 
00065   if (opts.init_from_registry () != 0)
00066     {
00067       report_status (SERVICE_STOPPED);
00068       return -1;
00069     }
00070 
00071   try
00072     {
00073       int status = server.init (opts);
00074 
00075       if (status == -1)
00076         {
00077           report_status (SERVICE_STOPPED);
00078           return -1;
00079         }
00080       else
00081         {
00082           report_status (SERVICE_RUNNING);
00083           server.run ();
00084 
00085           status = server.fini ();
00086 
00087           report_status (SERVICE_STOPPED);
00088 
00089         }
00090         if (status != -1)
00091             return 0;
00092     }
00093   catch (const CORBA::SystemException& sysex)
00094     {
00095       sysex._tao_print_exception (IMR_LOCATOR_DISPLAY_NAME);
00096     }
00097   catch (const CORBA::UserException& userex)
00098     {
00099       userex._tao_print_exception (IMR_LOCATOR_DISPLAY_NAME);
00100     }
00101   catch (const CORBA::Exception& ex)
00102     {
00103       ex._tao_print_exception (IMR_LOCATOR_DISPLAY_NAME);
00104     }
00105 
00106   report_status (SERVICE_STOPPED);
00107 
00108   return -1;
00109 }


Friends And Related Function Documentation

friend class ACE_Singleton< Locator_NT_Service, MUTEX > [friend]
 

Definition at line 53 of file Locator_NT_Service.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 15:55:56 2008 for TAO_Implementation_Repository by doxygen 1.3.6