From 7cbe7a1028c14148a8a6ae34c95a517bc15826d4 Mon Sep 17 00:00:00 2001 From: wolff1 Date: Fri, 12 Dec 2008 23:43:42 +0000 Subject: ChangeLogTag: Fri Dec 12 23:31:02 UTC 2008 Friedhelm Wolf --- .../FTComponentServer/AppMonitor/AppMonitor.mpc | 17 --- .../AppMonitor/AppSideMonitor_Handler.cpp | 41 ------- .../AppMonitor/AppSideMonitor_Handler.h | 40 ------- .../AppMonitor/AppSideMonitor_Thread.cpp | 47 -------- .../AppMonitor/AppSideMonitor_Thread.h | 45 ------- .../FTComponentServer/AppMonitor/AppSideReg.cpp | 129 --------------------- .../ciao/FTComponentServer/AppMonitor/AppSideReg.h | 48 -------- .../AppMonitor/appmonitor_export.h | 58 --------- CIAO/ciao/FTComponentServer/AppMonitor/monitor.idl | 12 -- 9 files changed, 437 deletions(-) delete mode 100644 CIAO/ciao/FTComponentServer/AppMonitor/AppMonitor.mpc delete mode 100644 CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Handler.cpp delete mode 100644 CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Handler.h delete mode 100644 CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Thread.cpp delete mode 100644 CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Thread.h delete mode 100644 CIAO/ciao/FTComponentServer/AppMonitor/AppSideReg.cpp delete mode 100644 CIAO/ciao/FTComponentServer/AppMonitor/AppSideReg.h delete mode 100644 CIAO/ciao/FTComponentServer/AppMonitor/appmonitor_export.h delete mode 100644 CIAO/ciao/FTComponentServer/AppMonitor/monitor.idl diff --git a/CIAO/ciao/FTComponentServer/AppMonitor/AppMonitor.mpc b/CIAO/ciao/FTComponentServer/AppMonitor/AppMonitor.mpc deleted file mode 100644 index b8b5c4d32bf..00000000000 --- a/CIAO/ciao/FTComponentServer/AppMonitor/AppMonitor.mpc +++ /dev/null @@ -1,17 +0,0 @@ -project (AppMonitor) : taolib, taoidldefaults, ciao_lib, naming { - - idlflags += -Wb,export_macro=AppMonitor_Export -Wb,export_include=appmonitor_export.h - macros += APPMONITOR_BUILD_DLL - includes += .. - - IDL_Files { - monitor.idl - } - - Source_Files { - monitorC.cpp - AppSideMonitor_Handler.cpp - AppSideMonitor_Thread.cpp - AppSideReg.cpp - } -} \ No newline at end of file diff --git a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Handler.cpp b/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Handler.cpp deleted file mode 100644 index 104d3361819..00000000000 --- a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Handler.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file C++ Implementation: AppSideMonitor_Handler - * - * @brief Defines implementation of AppSideMonitor_Handler. - * - */ - -#include "AppSideMonitor_Handler.h" -#include - -AppSideMonitor_Handler::AppSideMonitor_Handler () -: acceptor_ (0) -{ - int *i = 0; - std::cout << *i; - std::cerr << "AppSideMonitor_Handler::AppSideMonitor_Handler\n"; -} - -int AppSideMonitor_Handler::handle_input (ACE_HANDLE) -{ - char ch; - - if (this->peer().recv (&ch, sizeof (ch) <= 0)) - { - ACE_DEBUG((LM_DEBUG,"It looks like the monitor failed!\n")); -// acceptor_->open (); - } - else - ACE_DEBUG((LM_DEBUG,"It looks like the monitor is misbehaving!\n")); - - return -1; -} - -int AppSideMonitor_Handler::open (void *factory) -{ - ACE_DEBUG((LM_DEBUG,"AppSideMonitor_Handler::open\n")); - acceptor_ = static_cast (factory); -// acceptor_->close(); - return super::open (factory); -} - diff --git a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Handler.h b/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Handler.h deleted file mode 100644 index bf782cd84a6..00000000000 --- a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Handler.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file C++ Interface: AppSideMonitor_Handler - * - * @brief Declares interface for AppSideMonitor_Handler. - * - */ - -#ifndef __APPSIDEMONITOR_HANDLER_H_ -#define __APPSIDEMONITOR_HANDLER_H_ - -#include "ace/Svc_Handler.h" -#include "ace/SOCK_Acceptor.h" -#include "ace/Acceptor.h" - -/** - * @class AppSideMonitor_Handler - * - * @brief Encapsulates AppSideMonitor_Handler - */ - -class AppSideMonitor_Handler : public ACE_Svc_Handler -{ - public: - - typedef ACE_Svc_Handler super; - typedef ACE_Acceptor FactoryAcceptor; - - //private: - AppSideMonitor_Handler (); - public: - - virtual int handle_input (ACE_HANDLE fd); - virtual int open (void *factory); - - private: - FactoryAcceptor *acceptor_; -}; - -#endif /// __APPSIDEMONITOR_HANDLER_H_ - diff --git a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Thread.cpp b/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Thread.cpp deleted file mode 100644 index b7e33c92b8f..00000000000 --- a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Thread.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file C++ Implementation: AppSideMonitor_Thread - * - * @brief Defines implementation of AppSideMonitor_Thread. - * - */ - -#include "AppSideMonitor_Thread.h" -#include "ace/TP_Reactor.h" - -AppSideMonitor_Thread::AppSideMonitor_Thread (ACE_Barrier *thread_barrier, - u_short port) -: port_ (port), - reactor_ (new ACE_TP_Reactor), - acceptor_ (serv_addr_, &reactor_), - synchronizer_ (thread_barrier) -{ -} - -int AppSideMonitor_Thread::svc (void) -{ - if (serv_addr_.set (this->port_) == -1) - { - ACE_DEBUG ((LM_ERROR, "Can't set port.\n")); - return EXIT_FAILURE; - } - if (acceptor_.open (serv_addr_) == -1) - { - ACE_DEBUG ((LM_DEBUG, "The Acceptor can't open the socket.\n")); - return EXIT_FAILURE; - } - - this->synchronizer_->wait (); - this->synchronizer_ = 0; - - //ACE_DEBUG ((LM_DEBUG, "Entering reactor event loop.\n")); - if (reactor_.run_reactor_event_loop() == -1) - ACE_ERROR_RETURN ((LM_ERROR,"run_reactor_event_loop failed\n"), -1); - - return 0; -} - -void AppSideMonitor_Thread::stop () -{ - if (reactor_.end_reactor_event_loop() == -1) - ACE_DEBUG((LM_ERROR,"end_reactor_event_loop failed\n")); -} diff --git a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Thread.h b/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Thread.h deleted file mode 100644 index 8b03230e61f..00000000000 --- a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideMonitor_Thread.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file C++ Interface: AppSideMonitor_Thread - * - * @brief Declares interface for AppSideMonitor_Thread. - * - */ - -#ifndef __APPSIDEMONITOR_THREAD_H_ -#define __APPSIDEMONITOR_THREAD_H_ - -#include "ace/Task.h" -#include "ace/SOCK_Acceptor.h" -#include "ace/Reactor.h" -#include "ace/Barrier.h" -#include "ace/Acceptor.h" - -#include "AppSideMonitor_Handler.h" - -/** - * @class AppSideMonitor_Thread - * - * @brief Encapsulates AppSideMonitor_Thread - */ - -class AppSideMonitor_Thread : public ACE_Task_Base -{ -public: - - AppSideMonitor_Thread (ACE_Barrier *thread_barrier, - u_short port); - - void stop (); - virtual int svc (void); - -private: - u_short port_; - ACE_SOCK_Acceptor::PEER_ADDR serv_addr_; - ACE_Reactor reactor_; - ACE_Acceptor acceptor_; - ACE_Barrier *synchronizer_; -}; - - - -#endif /// __APPSIDEMONITOR_THREAD_H_ diff --git a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideReg.cpp b/CIAO/ciao/FTComponentServer/AppMonitor/AppSideReg.cpp deleted file mode 100644 index e7f148d2252..00000000000 --- a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideReg.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @file C++ Implementation: AppSideReg - * - * @brief Defines implementation of AppSideReg. - * - */ - -#include "AppSideReg.h" -#include "monitorC.h" -#include "ace/Barrier.h" -#include -#include -#include -#include -#include "Name_Helper_T.h" - -AppSideReg::AppSideReg(ACE_Barrier *ext_barrier, CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)), - external_barrier_ (ext_barrier) -{ -} - - -AppSideReg::~AppSideReg() -{ - monitor_->stop (); - orb_->destroy (); -} - -void AppSideReg::unregister_process (void) -{ - hmvar_->unregister_process (this->get_process_id ().c_str ()); -} - -int AppSideReg::svc(void) -{ - try - { - Name_Helper_T hmh (orb_.in (), true); - - hmvar_ = hmh.resolve ("FLARe/" + - hmh.escape_dots (this->get_hostname ()) + - "/HostMonitor"); - - u_short port = hmvar_->heartbeat_port (); - - ACE_Barrier internal_thread_barrier (2); - monitor_ = std::auto_ptr - (new AppSideMonitor_Thread (&internal_thread_barrier, - port)); - monitor_->activate (); - - //ACE_DEBUG ((LM_DEBUG, "Monitor activated\n")); - - internal_thread_barrier.wait (); - - /// Waiting for the AppSideMonitor_Thread to finish its socket stuff. - try - { - hmvar_->dump (); - } - catch (CORBA::Exception &) - { - ACE_DEBUG ((LM_DEBUG,"exception from dump.\n")); - throw; - } - - try - { - if (hmvar_->register_process ( - this->get_process_id ().c_str (), - this->get_hostname ().c_str (), - port)) - { - } - else - { - ACE_DEBUG ((LM_ERROR, "Registeration with the monitor failed.\n")); - } - } - catch (CORBA::Exception &) - { - ACE_DEBUG ((LM_DEBUG,"exception from register_process.\n")); - throw; - } - - - //ACE_DEBUG ((LM_DEBUG, "Registering process\n")); - } - catch (CORBA::Exception &ex) - { - ACE_PRINT_EXCEPTION (ex, "AppSideReg::svc - CORBA exception was raised:"); - return -1; - } - catch (Name_Helper_Exception & ex) - { - ACE_ERROR ((LM_ERROR, "AppSideReg::svc - " - "Name helper exception: %s", ex.what ())); - } - catch (...) - { - ACE_DEBUG((LM_ERROR, "AppSideReg::svc - Unknown exception raised!")); - return -1; - } - - //ACE_DEBUG ((LM_DEBUG, "AppSideReg::svc waiting on barrier.\n")); - - external_barrier_->wait (); - return 0; -} - -std::string -AppSideReg::get_hostname () -{ - char hn_str [100]; - gethostname (hn_str, sizeof (hn_str)); - - return std::string (hn_str); -} - -std::string -AppSideReg::get_process_id () -{ - pid_t pid = ACE_OS::getpid (); - std::stringstream ss; - ss << pid; - - return ss.str (); -} diff --git a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideReg.h b/CIAO/ciao/FTComponentServer/AppMonitor/AppSideReg.h deleted file mode 100644 index d9ca9975ff7..00000000000 --- a/CIAO/ciao/FTComponentServer/AppMonitor/AppSideReg.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file C++ Interface: AppSideReg - * - * @brief Declares interface for AppSideReg. - * - */ - -#ifndef __APPSIDEREG_H_ -#define __APPSIDEREG_H_ - -#include "ace/Task.h" -#include "appmonitor_export.h" -#include "monitorC.h" -#include "AppSideMonitor_Thread.h" - -#include - -/** - * @class AppSideReg - * - * @brief Encapsulates AppSideReg - */ - -class ACE_Barrier; - -class AppMonitor_Export AppSideReg : public ACE_Task_Base -{ -public: - AppSideReg(ACE_Barrier *ext_b, CORBA::ORB_ptr); - - ~AppSideReg(); - - virtual int svc (void); - void unregister_process (void); - -private: - std::string get_hostname (); - std::string get_process_id (); - - std::auto_ptr monitor_; - HostMonitor_var hmvar_; - CORBA::ORB_var orb_; - ACE_Barrier *external_barrier_; -}; - - - -#endif /// __APPSIDEREG_H_ diff --git a/CIAO/ciao/FTComponentServer/AppMonitor/appmonitor_export.h b/CIAO/ciao/FTComponentServer/AppMonitor/appmonitor_export.h deleted file mode 100644 index 68f83a33309..00000000000 --- a/CIAO/ciao/FTComponentServer/AppMonitor/appmonitor_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl AppMonitor -// ------------------------------ -#ifndef APPMONITOR_EXPORT_H -#define APPMONITOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (APPMONITOR_HAS_DLL) -# define APPMONITOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && APPMONITOR_HAS_DLL */ - -#if !defined (APPMONITOR_HAS_DLL) -# define APPMONITOR_HAS_DLL 1 -#endif /* ! APPMONITOR_HAS_DLL */ - -#if defined (APPMONITOR_HAS_DLL) && (APPMONITOR_HAS_DLL == 1) -# if defined (APPMONITOR_BUILD_DLL) -# define AppMonitor_Export ACE_Proper_Export_Flag -# define APPMONITOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define APPMONITOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* APPMONITOR_BUILD_DLL */ -# define AppMonitor_Export ACE_Proper_Import_Flag -# define APPMONITOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define APPMONITOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* APPMONITOR_BUILD_DLL */ -#else /* APPMONITOR_HAS_DLL == 1 */ -# define AppMonitor_Export -# define APPMONITOR_SINGLETON_DECLARATION(T) -# define APPMONITOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* APPMONITOR_HAS_DLL == 1 */ - -// Set APPMONITOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (APPMONITOR_NTRACE) -# if (ACE_NTRACE == 1) -# define APPMONITOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define APPMONITOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !APPMONITOR_NTRACE */ - -#if (APPMONITOR_NTRACE == 1) -# define APPMONITOR_TRACE(X) -#else /* (APPMONITOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define APPMONITOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (APPMONITOR_NTRACE == 1) */ - -#endif /* APPMONITOR_EXPORT_H */ - -// End of auto generated file. diff --git a/CIAO/ciao/FTComponentServer/AppMonitor/monitor.idl b/CIAO/ciao/FTComponentServer/AppMonitor/monitor.idl deleted file mode 100644 index ed413378142..00000000000 --- a/CIAO/ciao/FTComponentServer/AppMonitor/monitor.idl +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef MONITOR_IDL -#define MONITOR_IDL - -interface HostMonitor -{ - boolean register_process (in string process_id, in string hostname, in long port); - boolean unregister_process (in string process_id); - short heartbeat_port (); - void dump (); -}; - -#endif // MONITOR_IDL -- cgit v1.2.1