Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ImR_NT_Service Class Reference

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

#include <NT_Service.h>

Inheritance diagram for ImR_NT_Service:

Inheritance graph
[legend]
Collaboration diagram for ImR_NT_Service:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TAO_SYNCH_RECURSIVE_MUTEX MUTEX

Public Methods

 ImR_NT_Service (void)
 Constructor (not protected since it is used by ACE_NT_SERVICE_DEFINE). More...

virtual ~ImR_NT_Service (void)
 Destructor. More...

virtual void handle_control (DWORD control_code)
 We override <handle_control> because it handles stop requests privately. More...

virtual int handle_exception (ACE_HANDLE h)
 We override <handle_exception> so a 'stop' control code can wake the reactor off of its wait. More...

virtual int svc (void)
 This is a virtual method inherited from ACE_NT_Service. More...


Friends

class ACE_Singleton< ImR_NT_Service, MUTEX >

Detailed Description

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

Definition at line 39 of file NT_Service.h.


Member Typedef Documentation

typedef TAO_SYNCH_RECURSIVE_MUTEX ImR_NT_Service::MUTEX
 

Definition at line 42 of file NT_Service.h.


Constructor & Destructor Documentation

ImR_NT_Service::ImR_NT_Service void   
 

Constructor (not protected since it is used by ACE_NT_SERVICE_DEFINE).

Default constructor, does nothing special.

Definition at line 25 of file NT_Service.cpp.

00026 {
00027 }

ImR_NT_Service::~ImR_NT_Service void    [virtual]
 

Destructor.

Destructor, does nothing special.

Definition at line 32 of file NT_Service.cpp.

00033 {
00034 }


Member Function Documentation

void ImR_NT_Service::handle_control DWORD    control_code [virtual]
 

We override <handle_control> because it handles stop requests privately.

Handles the SERVICE_CONTROL_SHUTDOWN and SERVICE_CONTROL_STOP commands by shutting down the ORB. Otherwise ACE_NT_Service::handle_control handles the command.

Reimplemented from ACE_NT_Service.

Definition at line 42 of file 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.

00043 {
00044   if (control_code == SERVICE_CONTROL_SHUTDOWN
00045       || control_code == SERVICE_CONTROL_STOP)
00046     {
00047       report_status (SERVICE_STOP_PENDING);
00048       TAO_ORB_Core_instance ()->reactor ()->end_reactor_event_loop ();
00049       TAO_ORB_Core_instance ()->orb ()->shutdown (1);
00050       report_status (SERVICE_STOPPED);
00051     }
00052   else
00053     {
00054       ACE_NT_Service::handle_control (control_code);
00055     }
00056 }

int ImR_NT_Service::handle_exception ACE_HANDLE    h [virtual]
 

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

Reimplemented from ACE_Event_Handler.

Definition at line 62 of file NT_Service.cpp.

00063 {
00064   return 0;
00065 }

int ImR_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 () except that we update the report_status after init.

Reimplemented from ACE_NT_Service.

Definition at line 73 of file NT_Service.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCH, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, ImR_Activator_i::fini, ImR_Activator_i::init, ACE_NT_Service::report_status, and ImR_Activator_i::run.

00074 {
00075   ImR_Activator_i server;
00076 
00077   int status = 0;
00078 
00079   ACE_DECLARE_NEW_CORBA_ENV;
00080   ACE_TRY
00081     {
00082       status = server.init (ACE_ENV_SINGLE_ARG_PARAMETER);
00083       ACE_TRY_CHECK;
00084 
00085       if (status == -1)
00086         {
00087           return -1;
00088         }
00089       else
00090         {
00091           report_status (SERVICE_RUNNING);
00092           server.run (ACE_ENV_SINGLE_ARG_PARAMETER);
00093           ACE_TRY_CHECK;
00094 
00095           status = server.fini (ACE_ENV_SINGLE_ARG_PARAMETER);
00096           ACE_TRY_CHECK;
00097 
00098           if (status == -1)
00099               return -1;
00100         }
00101     }
00102   ACE_CATCH (CORBA::SystemException, sysex)
00103     {
00104       ACE_PRINT_EXCEPTION (sysex, "Implementation Repository");
00105       return -1;
00106     }
00107   ACE_CATCH (CORBA::UserException, userex)
00108     {
00109       ACE_PRINT_EXCEPTION (userex, "Implementation Repository");
00110       return -1;
00111     }
00112   ACE_CATCHANY
00113     {
00114       ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Implementation Repository");
00115       return -1;
00116     }
00117   ACE_ENDTRY;
00118 
00119   return 0;
00120 }


Friends And Related Function Documentation

friend class ACE_Singleton< ImR_NT_Service, MUTEX > [friend]
 

Definition at line 62 of file NT_Service.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 20:04:23 2003 for TAO_Implementation_Repository by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002