Locator_NT_Service Class Reference

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

#include <Locator_NT_Service.h>

Inheritance diagram for Locator_NT_Service:

Inheritance graph
[legend]
Collaboration diagram for Locator_NT_Service:

Collaboration graph
[legend]
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.

Reimplemented from ACE_NT_Service.

Definition at line 31 of file Locator_NT_Service.cpp.

References ACE_Reactor::end_reactor_event_loop(), ACE_NT_Service::handle_control(), TAO_ORB_Core::orb(), TAO_ORB_Core::reactor(), ACE_NT_Service::report_status(), 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.

Reimplemented from ACE_Event_Handler.

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 ()

Reimplemented from ACE_NT_Service.

Definition at line 60 of file Locator_NT_Service.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCH, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, ImR_Locator_i::fini(), ImR_Locator_i::init(), Options::init_from_registry(), ACE_NT_Service::report_status(), 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   ACE_DECLARE_NEW_CORBA_ENV;
00072   ACE_TRY
00073     {
00074       int status = server.init (opts ACE_ENV_ARG_PARAMETER);
00075       ACE_TRY_CHECK;
00076 
00077       if (status == -1)
00078         {
00079           report_status (SERVICE_STOPPED);
00080           return -1;
00081         }
00082       else
00083         {
00084           report_status (SERVICE_RUNNING);
00085           server.run (ACE_ENV_SINGLE_ARG_PARAMETER);
00086           ACE_TRY_CHECK;
00087 
00088           status = server.fini (ACE_ENV_SINGLE_ARG_PARAMETER);
00089           ACE_TRY_CHECK;
00090 
00091           report_status (SERVICE_STOPPED);
00092 
00093         }
00094         if (status != -1)
00095             return 0;
00096     }
00097   ACE_CATCH (CORBA::SystemException, sysex)
00098     {
00099       ACE_PRINT_EXCEPTION (sysex, IMR_LOCATOR_DISPLAY_NAME);
00100     }
00101   ACE_CATCH (CORBA::UserException, userex)
00102     {
00103       ACE_PRINT_EXCEPTION (userex, IMR_LOCATOR_DISPLAY_NAME);
00104     }
00105   ACE_CATCHANY
00106     {
00107       ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, IMR_LOCATOR_DISPLAY_NAME);
00108     }
00109   ACE_ENDTRY;
00110 
00111   report_status (SERVICE_STOPPED);
00112 
00113   return -1;
00114 }


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 Thu Nov 9 13:37:21 2006 for TAO_Implementation_Repository by doxygen 1.3.6