00001 // $Id: MonitorManager.h 87298 2009-11-02 23:00:17Z dai_y $ 00002 00003 #ifndef MONITORMANAGER_H 00004 #define MONITORMANAGER_H 00005 00006 #include /**/ "ace/pre.h" 00007 00008 #include "ace/Service_Object.h" 00009 #include "ace/Task.h" 00010 #include "ace/ARGV.h" 00011 #include "ace/Atomic_Op.h" 00012 #include "ace/Barrier.h" 00013 #include "ace/Service_Config.h" 00014 00015 #include "tao/ORB.h" 00016 00017 #if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1) 00018 00019 #include "orbsvcs/Notify/MonitorControl/notify_mc_export.h" 00020 00021 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00022 00023 class TAO_Notify_MC_Export TAO_MonitorManager : public ACE_Service_Object 00024 { 00025 public: 00026 /// Perform member initialization 00027 TAO_MonitorManager (void); 00028 00029 virtual int init (int argc, ACE_TCHAR* argv[]); 00030 virtual int fini (void); 00031 00032 /// Start the ORB task which includes initializtion of the ORB, 00033 /// creation of the monitor servant and activation. 00034 /// If run is called more than once, it will silently perform a no-op. 00035 int run (void); 00036 00037 /// This will call the run() method. 00038 virtual int resume (void); 00039 00040 /// Get the dynamic instance of the TAO_MonitorManager and 00041 /// shut it down 00042 static void shutdown (void); 00043 00044 private: 00045 class ORBTask: public ACE_Task_Base 00046 { 00047 public: 00048 ORBTask (void); 00049 virtual int svc (void); 00050 00051 TAO_SYNCH_MUTEX mutex_; 00052 ACE_ARGV_T<ACE_TCHAR> argv_; 00053 CORBA::ORB_var orb_; 00054 ACE_TString ior_output_; 00055 bool use_name_svc_; 00056 ACE_Barrier startup_barrier_; 00057 ACE_TString mc_orb_name_; 00058 }; 00059 00060 bool run_; 00061 bool initialized_; 00062 ORBTask task_; 00063 }; 00064 00065 TAO_END_VERSIONED_NAMESPACE_DECL 00066 00067 #define TAO_NOTIFY_MONITOR_CONTROL_MANAGER "TAO_MonitorAndControl" 00068 00069 ACE_STATIC_SVC_DECLARE_EXPORT(TAO_Notify_MC, TAO_MonitorAndControl) 00070 ACE_FACTORY_DECLARE(TAO_Notify_MC, TAO_MonitorAndControl) 00071 00072 00073 #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */ 00074 00075 #include /**/ "ace/post.h" 00076 00077 #endif /* MONITORMANAGER_H */