diff options
author | aky <aky@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-06-16 20:28:00 +0000 |
---|---|---|
committer | aky <aky@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-06-16 20:28:00 +0000 |
commit | ea2354fe1a7b7c40defc6c4094e1477051e91ca8 (patch) | |
tree | a8b4d98e24f547b93e62cb47f567b53daa7e31cd | |
parent | eb6d9d34c28a9b1ce979b4c4c962f06fce515aea (diff) | |
download | ATCD-DeCoM.tar.gz |
Thu Jun 16 20:25:08 UTC 2011 Akshay V. Dabholkar <aky@dre.vanderbilt.edu>DeCoM
* orbsvcs/LWFT_Service:
* orbsvcs/LWFT_Service/LWFT_Service.mpc:
* orbsvcs/LWFT_Service/RMOptions.h:
* orbsvcs/LWFT_Service/RMOptions.cpp:
* orbsvcs/LWFT_Service/ReplicationManager_process.cpp:
* orbsvcs/LWFT_Service/host_monitor.cpp:
* orbsvcs/orbsvcs/LWFT:
* orbsvcs/orbsvcs/LWFT/AppInfo.idl:
* orbsvcs/orbsvcs/LWFT/AppOptions.h:
* orbsvcs/orbsvcs/LWFT/AppOptions.cpp:
* orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.h:
* orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.cpp:
* orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h:
* orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp:
* orbsvcs/orbsvcs/LWFT/AppSideReg.h:
* orbsvcs/orbsvcs/LWFT/AppSideReg.cpp:
* orbsvcs/orbsvcs/LWFT/Barrier_Guard.h:
* orbsvcs/orbsvcs/LWFT/Barrier_Guard.cpp:
* orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.h:
* orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.cpp:
* orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.h:
* orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.cpp:
* orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.h:
* orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.cpp:
* orbsvcs/orbsvcs/LWFT/DDSFailure.h:
* orbsvcs/orbsvcs/LWFT/DDSFailure.cpp:
* orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.h:
* orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.cpp:
* orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.h:
* orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.cpp:
* orbsvcs/orbsvcs/LWFT/Failure_Handler.h:
* orbsvcs/orbsvcs/LWFT/Failure_Handler.cpp:
* orbsvcs/orbsvcs/LWFT/FaultNotification.idl:
* orbsvcs/orbsvcs/LWFT/ForwardingAgent.h:
* orbsvcs/orbsvcs/LWFT/ForwardingAgent.cpp:
* orbsvcs/orbsvcs/LWFT/ForwardingAgent.idl:
* orbsvcs/orbsvcs/LWFT/HMOptions.h:
* orbsvcs/orbsvcs/LWFT/HMOptions.cpp:
* orbsvcs/orbsvcs/LWFT/HostMonitor.idl:
* orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h:
* orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp:
* orbsvcs/orbsvcs/LWFT/IOR_Interceptor.h:
* orbsvcs/orbsvcs/LWFT/IOR_Interceptor.cpp:
* orbsvcs/orbsvcs/LWFT/LWFT.mpc:
* orbsvcs/orbsvcs/LWFT/LWFTDataStructures.idl:
* orbsvcs/orbsvcs/LWFT/LWFT_Client.vcproj:
* orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.h:
* orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.cpp:
* orbsvcs/orbsvcs/LWFT/LWFT_Common.vcproj:
* orbsvcs/orbsvcs/LWFT/LWFT_ReplicationManager.vcproj:
* orbsvcs/orbsvcs/LWFT/LWFT_Server.vcproj:
* orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.h:
* orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.cpp:
* orbsvcs/orbsvcs/LWFT/LWFT_StateSyncAgent.vcproj:
* orbsvcs/orbsvcs/LWFT/Monitor_Manager.h:
* orbsvcs/orbsvcs/LWFT/Monitor_Manager.inl:
* orbsvcs/orbsvcs/LWFT/Monitor_Manager.cpp:
* orbsvcs/orbsvcs/LWFT/Monitor_Thread.h:
* orbsvcs/orbsvcs/LWFT/Monitor_Thread.cpp:
* orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.h:
* orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.cpp:
* orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.idl:
* orbsvcs/orbsvcs/LWFT/README:
* orbsvcs/orbsvcs/LWFT/RM_Proxy.h:
* orbsvcs/orbsvcs/LWFT/RM_Proxy.cpp:
* orbsvcs/orbsvcs/LWFT/ReplicatedApplication.idl:
* orbsvcs/orbsvcs/LWFT/ReplicationManager.h:
* orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp:
* orbsvcs/orbsvcs/LWFT/ReplicationManager.idl:
* orbsvcs/orbsvcs/LWFT/ServerORBInitializer.h:
* orbsvcs/orbsvcs/LWFT/ServerORBInitializer.cpp:
* orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.h:
* orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.cpp:
* orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent.idl:
* orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h:
* orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.cpp:
* orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i_T.cpp:
* orbsvcs/orbsvcs/LWFT/StatefulObject.h:
* orbsvcs/orbsvcs/LWFT/StatefulObject.cpp:
* orbsvcs/orbsvcs/LWFT/Timer.h:
* orbsvcs/orbsvcs/LWFT/Timer.cpp:
* orbsvcs/orbsvcs/LWFT/Utilization_Monitor.h:
* orbsvcs/orbsvcs/LWFT/Utilization_Monitor.cpp:
* orbsvcs/orbsvcs/LWFT/host_monitor_export.h:
* orbsvcs/orbsvcs/LWFT/lwft_client_export.h:
* orbsvcs/orbsvcs/LWFT/lwft_common_export.h:
* orbsvcs/orbsvcs/LWFT/lwft_server_export.h:
* orbsvcs/orbsvcs/LWFT/rm_export.h:
* orbsvcs/orbsvcs/LWFT/rm_impl_export.h:
* orbsvcs/orbsvcs/LWFT/ssa_export.h:
Merged additive orbsvcs of LWFT(FLARE) implementation
89 files changed, 11931 insertions, 0 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index de14faf5bc0..de413b72512 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,101 @@ +Thu Jun 16 20:25:08 UTC 2011 Akshay V. Dabholkar <aky@dre.vanderbilt.edu> + + * orbsvcs/LWFT_Service: + + * orbsvcs/LWFT_Service/LWFT_Service.mpc: + * orbsvcs/LWFT_Service/RMOptions.h: + * orbsvcs/LWFT_Service/RMOptions.cpp: + * orbsvcs/LWFT_Service/ReplicationManager_process.cpp: + * orbsvcs/LWFT_Service/host_monitor.cpp: + + * orbsvcs/orbsvcs/LWFT: + + * orbsvcs/orbsvcs/LWFT/AppInfo.idl: + * orbsvcs/orbsvcs/LWFT/AppOptions.h: + * orbsvcs/orbsvcs/LWFT/AppOptions.cpp: + * orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.h: + * orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.cpp: + * orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h: + * orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp: + * orbsvcs/orbsvcs/LWFT/AppSideReg.h: + * orbsvcs/orbsvcs/LWFT/AppSideReg.cpp: + * orbsvcs/orbsvcs/LWFT/Barrier_Guard.h: + * orbsvcs/orbsvcs/LWFT/Barrier_Guard.cpp: + * orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.h: + * orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.cpp: + * orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.h: + * orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.cpp: + * orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.h: + * orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.cpp: + * orbsvcs/orbsvcs/LWFT/DDSFailure.h: + * orbsvcs/orbsvcs/LWFT/DDSFailure.cpp: + * orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.h: + * orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.cpp: + * orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.h: + * orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.cpp: + * orbsvcs/orbsvcs/LWFT/Failure_Handler.h: + * orbsvcs/orbsvcs/LWFT/Failure_Handler.cpp: + * orbsvcs/orbsvcs/LWFT/FaultNotification.idl: + * orbsvcs/orbsvcs/LWFT/ForwardingAgent.h: + * orbsvcs/orbsvcs/LWFT/ForwardingAgent.cpp: + * orbsvcs/orbsvcs/LWFT/ForwardingAgent.idl: + * orbsvcs/orbsvcs/LWFT/HMOptions.h: + * orbsvcs/orbsvcs/LWFT/HMOptions.cpp: + * orbsvcs/orbsvcs/LWFT/HostMonitor.idl: + * orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h: + * orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp: + * orbsvcs/orbsvcs/LWFT/IOR_Interceptor.h: + * orbsvcs/orbsvcs/LWFT/IOR_Interceptor.cpp: + * orbsvcs/orbsvcs/LWFT/LWFT.mpc: + * orbsvcs/orbsvcs/LWFT/LWFTDataStructures.idl: + * orbsvcs/orbsvcs/LWFT/LWFT_Client.vcproj: + * orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.h: + * orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.cpp: + * orbsvcs/orbsvcs/LWFT/LWFT_Common.vcproj: + * orbsvcs/orbsvcs/LWFT/LWFT_ReplicationManager.vcproj: + * orbsvcs/orbsvcs/LWFT/LWFT_Server.vcproj: + * orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.h: + * orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.cpp: + * orbsvcs/orbsvcs/LWFT/LWFT_StateSyncAgent.vcproj: + * orbsvcs/orbsvcs/LWFT/Monitor_Manager.h: + * orbsvcs/orbsvcs/LWFT/Monitor_Manager.inl: + * orbsvcs/orbsvcs/LWFT/Monitor_Manager.cpp: + * orbsvcs/orbsvcs/LWFT/Monitor_Thread.h: + * orbsvcs/orbsvcs/LWFT/Monitor_Thread.cpp: + * orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.h: + * orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.cpp: + * orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.idl: + * orbsvcs/orbsvcs/LWFT/README: + * orbsvcs/orbsvcs/LWFT/RM_Proxy.h: + * orbsvcs/orbsvcs/LWFT/RM_Proxy.cpp: + * orbsvcs/orbsvcs/LWFT/ReplicatedApplication.idl: + * orbsvcs/orbsvcs/LWFT/ReplicationManager.h: + * orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp: + * orbsvcs/orbsvcs/LWFT/ReplicationManager.idl: + * orbsvcs/orbsvcs/LWFT/ServerORBInitializer.h: + * orbsvcs/orbsvcs/LWFT/ServerORBInitializer.cpp: + * orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.h: + * orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.cpp: + * orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent.idl: + * orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h: + * orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.cpp: + * orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i_T.cpp: + * orbsvcs/orbsvcs/LWFT/StatefulObject.h: + * orbsvcs/orbsvcs/LWFT/StatefulObject.cpp: + * orbsvcs/orbsvcs/LWFT/Timer.h: + * orbsvcs/orbsvcs/LWFT/Timer.cpp: + * orbsvcs/orbsvcs/LWFT/Utilization_Monitor.h: + * orbsvcs/orbsvcs/LWFT/Utilization_Monitor.cpp: + * orbsvcs/orbsvcs/LWFT/host_monitor_export.h: + * orbsvcs/orbsvcs/LWFT/lwft_client_export.h: + * orbsvcs/orbsvcs/LWFT/lwft_common_export.h: + * orbsvcs/orbsvcs/LWFT/lwft_server_export.h: + * orbsvcs/orbsvcs/LWFT/rm_export.h: + * orbsvcs/orbsvcs/LWFT/rm_impl_export.h: + * orbsvcs/orbsvcs/LWFT/ssa_export.h: + + Merged additive orbsvcs of LWFT(FLARE) implementation + Thu Jun 16 20:01:41 UTC 2011 Akshay V. Dabholkar <aky@dre.vanderbilt.edu> * MPC/config/lwft_client.mpb: diff --git a/TAO/orbsvcs/LWFT_Service/LWFT_Service.mpc b/TAO/orbsvcs/LWFT_Service/LWFT_Service.mpc new file mode 100644 index 00000000000..c3489a2cfe8 --- /dev/null +++ b/TAO/orbsvcs/LWFT_Service/LWFT_Service.mpc @@ -0,0 +1,50 @@ +// -*- MPC -*- +// $Id$ + +project(ReplicationManager) : taoserver, naming, lwft_server { + after += LWFT_ReplicationManagerImpl + libs += LWFT_ReplicationManagerImpl + exename = ReplicationManager + + IDL_Files { + } + + Source_Files { + ReplicationManager_process.cpp + RMOptions.cpp + } + + Header_Files { + RMOptions.h + } + + Inline_Files { + } + + Template_Files { + } +} + +project(HostMonitor) : taoserver, portableserver, lwft_client { + after += LWFT_HostMonitor + libs += LWFT_Server \ + LWFT_HostMonitor + exename = HostMonitor + + IDL_Files { + } + + Source_Files { + host_monitor.cpp + } + + Header_Files { + } + + Inline_Files { + } + + Template_Files { + } +} + diff --git a/TAO/orbsvcs/LWFT_Service/RMOptions.cpp b/TAO/orbsvcs/LWFT_Service/RMOptions.cpp new file mode 100644 index 00000000000..0b95d4ef144 --- /dev/null +++ b/TAO/orbsvcs/LWFT_Service/RMOptions.cpp @@ -0,0 +1,110 @@ +// -*- C++ -*- +// $Id$ + +#include <sstream> + +#include "ace/Global_Macros.h" +#include "ace/Guard_T.h" +#include "ace/Log_Msg.h" +#include "ace/Arg_Shifter.h" + +#include "RMOptions.h" + +/// Initialize the static data member. +RMOptions * volatile RMOptions::instance_ = 0; +ACE_Auto_Ptr<RMOptions> RMOptions::deleter_; +ACE_Thread_Mutex RMOptions::lock_; + +RMOptions::RMOptions (void) + : hertz_ (0.2), + proactive_ (true), + static_mode_ (false), + use_naming_service_ (false) +{ +} + +RMOptions * +RMOptions::instance (void) +{ + if (instance_ == 0) + { + ACE_GUARD_RETURN (ACE_Thread_Mutex, guard, lock_, 0); + + if (instance_ == 0) + { + instance_ = new RMOptions; + deleter_.reset (instance_); + } + } + + return instance_; +} + +bool +RMOptions::parse_args (int &argc, char **argv) +{ + ACE_Arg_Shifter as (argc, argv); + + while (as.is_anything_left ()) + { + const ACE_TCHAR *arg = 0; + + if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-hertz")))) + { + std::istringstream istr (arg); + + if (!(istr >> hertz_)) + { + return false; + } + + as.consume_arg (); + } + else if (as.cur_arg_strncasecmp (ACE_TEXT ("-proactive")) == 0) + { + proactive_ = true; + as.consume_arg (); + } + else if (as.cur_arg_strncasecmp (ACE_TEXT ("-static")) == 0) + { + static_mode_ = true; + as.consume_arg (); + } + else if (as.cur_arg_strncasecmp (ACE_TEXT ("-use_ns")) == 0) + { + use_naming_service_ = true; + as.consume_arg (); + } + else + { + as.ignore_arg (); + } + } + + return true; +}; + + +bool +RMOptions::proactive (void) const +{ + return proactive_; +} + +double +RMOptions::hertz (void) const +{ + return hertz_; +} + +bool +RMOptions::static_mode (void) const +{ + return static_mode_; +} + +bool +RMOptions::use_naming_service (void) const +{ + return use_naming_service_; +} diff --git a/TAO/orbsvcs/LWFT_Service/RMOptions.h b/TAO/orbsvcs/LWFT_Service/RMOptions.h new file mode 100644 index 00000000000..f5ed455bcc2 --- /dev/null +++ b/TAO/orbsvcs/LWFT_Service/RMOptions.h @@ -0,0 +1,56 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file RMOptions.h + * + * @brief Declared the RMOptions class interface. + * + */ + +#ifndef _RMOPTIONS_H +#define _RMOPTIONS_H + +#include <string> + +#include "ace/Thread_Mutex.h" +#include "ace/Auto_Ptr.h" + +/** + * @class RMOptions + * + * @brief Declares RMOptions singleton to hold the command line options. + */ + +class RMOptions +/// TITLE +/// Singleton class for the program options. +{ +public: + /// Singleton access method. + static RMOptions *instance (void); + + bool parse_args (int &argc, char **argv); + + /// Member accessors. + bool proactive (void) const; + double hertz (void) const; + bool static_mode (void) const; + bool use_naming_service (void) const; + +protected: + /// Constructor is protected to ensure Singleton access. + RMOptions (void); + + double hertz_; + bool proactive_; + bool static_mode_; + bool use_naming_service_; + + /// Singleton-related stuff. + static RMOptions * volatile instance_; + static ACE_Auto_Ptr<RMOptions> deleter_; + static ACE_Thread_Mutex lock_; +}; + +#endif /* _RMOPTIONS_H */ diff --git a/TAO/orbsvcs/LWFT_Service/ReplicationManager_process.cpp b/TAO/orbsvcs/LWFT_Service/ReplicationManager_process.cpp new file mode 100644 index 00000000000..e9c046eee69 --- /dev/null +++ b/TAO/orbsvcs/LWFT_Service/ReplicationManager_process.cpp @@ -0,0 +1,242 @@ +// -*- C++ -*- +// $Id$ + +#include "ace/Get_Opt.h" + +#include "orbsvcs/orbsvcs/Naming/Naming_Client.h" + +#include "orbsvcs/orbsvcs/LWFT/ForwardingAgent.h" +#include "orbsvcs/orbsvcs/LWFT/ReplicationManager.h" +#include "orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.h" +#include "orbsvcs/orbsvcs/LWFT/AppOptions.h" +#include "orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.h" + +#include "RMOptions.h" + +char *ior_output_file = "rm.ior"; + +class RegistrationTask : public ACE_Task_Base +{ +public: + RegistrationTask (ReplicationManager_ptr primary_rm, + ReplicationManager_ptr local_rm, + CORBA::ORB_ptr orb) + : primary_rm_ (ReplicationManager::_duplicate (primary_rm)), + local_rm_ (ReplicationManager::_duplicate (local_rm)), + orb_ (CORBA::ORB::_duplicate (orb)) + { + } + + int svc (void) + { + try + { + // register ReplicationManager with itself + primary_rm_->register_application ( + local_rm_->object_id (), + 0.0, + AppOptions::instance ()->host_id ().c_str (), + AppOptions::instance ()->process_id ().c_str (), + AppOptions::instance ()->role (), + local_rm_.in ()); + } + catch (CORBA::Exception &) + { + ACE_ERROR ((LM_ERROR, "RM: Could not register reference to " + " the ReplicationManager with the primary " + "ReplicationManager.\n")); + return 1; + } + + return 0; + } + +private: + ReplicationManager_var primary_rm_; + ReplicationManager_var local_rm_; + CORBA::ORB_var orb_; +}; + +int +main (int argc, char *argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + + AppOptions::instance ()->parse_args (argc, argv); + + CORBA::Object_var object = + orb->resolve_initial_references ("RootPOA"); + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (object.in ()); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + CORBA::PolicyList policies; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + root_poa->create_lifespan_policy (PortableServer::PERSISTENT); + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + root_poa->create_id_assignment_policy (PortableServer::USER_ID); + + PortableServer::POA_var poa = + root_poa->create_POA ("Servant POA", + poa_manager.in (), + policies); + + poa_manager->activate (); + + // std::cout << "Before StateSyncAgent." << std::endl; + + StateSynchronizationAgent_i* ssa_servant = + new StateSynchronizationAgent_i ( + orb.in (), + AppOptions::instance ()->host_id (), + AppOptions::instance ()->process_id (), + !(AppOptions::instance ()->use_dds ())); + + PortableServer::ServantBase_var owner_xfer_ssa (ssa_servant); + + // create task for state synchronization agent + StateSyncAgentTask sync_agent_thread (orb.in (), + ssa_servant); + + int result = sync_agent_thread.activate (); + + if (result != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "StateSyncAgentTask::activate () " + "returned %d, errno = %d\n", + result, + errno), + -1); + } + + if (! RMOptions::instance ()->parse_args (argc, argv)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Replication Manager options " + "are incorrect.\n"), + -1); + } + + ReplicationManager_i *rm_i = 0; + ACE_NEW_RETURN (rm_i, + ReplicationManager_i (orb.in (), + RMOptions::instance()->hertz(), + RMOptions::instance()->proactive(), + RMOptions::instance()->static_mode ()), + 1); + + PortableServer::ServantBase_var owner_transfer (rm_i); + + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId (rm_i->object_id ()); + + poa->activate_object_with_id (oid.in (), rm_i); + + CORBA::Object_var rm_object = poa->id_to_reference (oid.in ()); + ReplicationManager_var rm = ReplicationManager::_narrow (rm_object.in ()); + + CORBA::String_var ior = + orb->object_to_string (rm.in ()); + +// ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); + + if (ior_output_file != 0) + { + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + + if (output_file == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot open output file " + "for writing IOR: %s", + ior_output_file), + 1); + } + + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + } + + ReplicationManager_var primary_rm; + + if (RMOptions::instance ()->use_naming_service ()) + { + TAO_Naming_Client naming_client; + naming_client.init (orb.in ()); + + CosNaming::Name rm_name; + rm_name.length (1UL); + rm_name[0UL].id = "ReplicationManager"; + + if (AppOptions::instance ()->role () == PRIMARY) + { + try + { + naming_client->bind (rm_name, rm.in ()); + } + catch (CosNaming::NamingContext::AlreadyBound &) + { + naming_client->rebind (rm_name, rm.in ()); + } + + primary_rm = ReplicationManager::_duplicate (rm.in ()); + + // ACE_DEBUG ((LM_INFO, + // "ReplicationManager registered with Naming Service\n")); + } + else + { + CORBA::Object_var rm_obj = naming_client->resolve (rm_name); + + primary_rm = ReplicationManager::_narrow (rm_obj.in ()); + } + } + else + { + primary_rm = ReplicationManager::_duplicate (rm.in ()); + } + + // add reference for state synchronization of the RM itself + rm_i->agent (sync_agent_thread.agent_ref ()); + + // register its own StateSynchronizationAgent + rm_i->register_state_synchronization_agent ( + AppOptions::instance ()->host_id ().c_str (), + AppOptions::instance ()->process_id ().c_str (), + sync_agent_thread.agent_ref ()); + + sync_agent_thread.agent_ref ()->register_application (rm_i->object_id (), + rm.in ()); + + RegistrationTask registration_task ( + primary_rm.in (), + rm.in (), + orb.in ()); + + if (registration_task.activate () == 0) + { + orb->run (); + } + + // ACE_DEBUG ((LM_DEBUG, "(%P|%t) RM - event loop finished\n")); + + poa->destroy (true, true); + orb->destroy (); + } + catch (CORBA::Exception &ex) + { + ex._tao_print_exception ("RM Process: caught exception:"); + return -1; + } + + return 0; +} diff --git a/TAO/orbsvcs/LWFT_Service/host_monitor.cpp b/TAO/orbsvcs/LWFT_Service/host_monitor.cpp new file mode 100644 index 00000000000..66cfd22ad29 --- /dev/null +++ b/TAO/orbsvcs/LWFT_Service/host_monitor.cpp @@ -0,0 +1,77 @@ +// -*- C++ -*- +// $Id$ + +#include <iostream> +#include <fstream> +#include <string> +#include <iterator> +#include <algorithm> + +#include "orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h" +#include "orbsvcs/orbsvcs/LWFT/Monitor_Thread.h" +#include "orbsvcs/orbsvcs/LWFT/HMOptions.h" +#include "orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.h" + +int main (int argc, char* argv[]) +{ + try + { + /// First initialize the ORB, that will remove some arguments... + LWFT_Client_Init ci; + CORBA::ORB_var orb = ci.init (argc, argv); + + /// Initilize RootPOA. + CORBA::Object_var poa_object = + orb->resolve_initial_references ("RootPOA"); + + /// Create the POA object reference to type POA. + PortableServer::POA_var poa = + PortableServer::POA::_narrow (poa_object.in ()); + + /// Activate the POA manager. + PortableServer::POAManager_var poa_manager = + poa->the_POAManager (); + poa_manager->activate (); + + HMOptions *opts = HMOptions::instance (); + + if (! opts->parse_args (argc, argv)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Host Monitor options " + "are incorrect.\n"), + -1); + } + + Monitor_Thread monitor_thread; + + /// Initilize the timedate object on heap. + HostMonitorImpl * host_monitor = + new HostMonitorImpl (orb, &monitor_thread); + PortableServer::ServantBase_var safe_host (host_monitor); + ACE_UNUSED_ARG (safe_host); + + HostMonitor_var hmvar = host_monitor->_this (); + CORBA::String_var hmstr = orb->object_to_string (hmvar.in ()); + + /// Copy the IOR in the IORFILE. + std::string ior_file (opts->HM_ior_file ()); + std::ofstream outfile (ior_file.c_str ()); + outfile << hmstr; + outfile.close (); + + monitor_thread.activate (); + orb->run (); + + /// Destroy the POA, waiting until the destruction terminates + poa->destroy (true, true); + orb->destroy (); + } + catch (CORBA::Exception &ex) + { + ACE_PRINT_EXCEPTION (ex, "A CORBA exception was raised:"); + return -1; + } + + return 0; +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppInfo.idl b/TAO/orbsvcs/orbsvcs/LWFT/AppInfo.idl new file mode 100644 index 00000000000..b243728626e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppInfo.idl @@ -0,0 +1,69 @@ +// -*- IDL -*- + +//============================================================================= +/** + * @file AppInfo.idl + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _LWFT_APPINFO_IDL_ +#define _LWFT_APPINFO_IDL_ + +#include "LWFTDataStructures.idl" +#include "StateSynchronizationAgent.idl" + +module FLARE +{ + module ReplicationManager + { + enum AppRole + { + PRIMARY, + BACKUP + }; + + struct AppInfo + { + string object_id; + double load; + string host_name; + string process_id; + AppRole role; + Object ior; + }; + + typedef sequence<AppInfo> AppInfoSeq; + + typedef ObjectList AgentList; + + struct StateSyncAgentEntry + { + StateSynchronizationAgent agent; + string process_id; + }; + + typedef sequence<StateSyncAgentEntry> StateSyncAgentEntries; + + struct HostUtil + { + string hostname; + double utilization; + }; + + typedef sequence<HostUtil> HostUtilSeq; + + struct ReplicationManagerState + { + AppInfoSeq app_set_list; + AgentList forwarding_agents; + StateSyncAgentEntries state_sync_agents; + HostUtilSeq utilization; + }; + }; // end module ReplicationManager +}; // end module FLARE + +#endif /* _LWFT_APPINFO_IDL_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppOptions.cpp b/TAO/orbsvcs/orbsvcs/LWFT/AppOptions.cpp new file mode 100644 index 00000000000..dee3a5698b7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppOptions.cpp @@ -0,0 +1,252 @@ +// -*- C++ -*- +// $Id$ + +#include "AppOptions.h" + +#include <sstream> + +#include "ace/Global_Macros.h" +#include "ace/Guard_T.h" +#include "ace/Log_Msg.h" +#include "ace/Arg_Shifter.h" + +/// Initialize the static data member. +AppOptions * volatile AppOptions::instance_ = 0; +ACE_Auto_Ptr<AppOptions> AppOptions::deleter_; +ACE_Thread_Mutex AppOptions::lock_; + +AppOptions::AppOptions (void) + : host_monitor_ior_ ("file://hm.ior"), + port_ (0), + role_ (2), + load_ (40.0), + use_dds_ (false), + debug_level_ (0) +{ + char hostname [100]; + gethostname (hostname, sizeof (hostname)); + host_id_ = hostname; +// ACE_DEBUG ((LM_DEBUG, "Hostname is %s.\n", hostname)); +} + +AppOptions * +AppOptions::instance (void) +{ + if (instance_ == 0) + { + ACE_GUARD_RETURN (ACE_Thread_Mutex, guard, lock_, 0); + + if (instance_ == 0) + { + instance_ = new AppOptions (); + deleter_.reset (instance_); + } + } + + return instance_; +} + +AppOptions::~AppOptions (void) +{ + monitor_->stop (); +} + +bool +AppOptions::parse_args (int &argc, char **argv) +{ + ACE_Arg_Shifter as (argc, argv); + + while (as.is_anything_left ()) + { + const ACE_TCHAR *arg = 0; + + if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-hm_port")))) + { + std::istringstream istr (arg); + + if (!(istr >> port_)) + { + return false; + } + + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-hm_ior")))) + { + host_monitor_ior_ = arg; + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-host_id")))) + { + host_id_ = arg; + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-proc_id")))) + { + process_id_ = arg; + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-info_file")))) + { + object_info_file_ = arg; + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-app_id")))) + { + app_id_ = arg; + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-role")))) + { + std::istringstream istr (arg); + + if (!(istr >> role_)) + { + return false; + } + + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-load")))) + { + std::istringstream istr (arg); + + if (!(istr >> load_)) + { + return false; + } + + as.consume_arg (); + } + else if (as.cur_arg_strncasecmp (ACE_TEXT ("-use_dds")) == 0) + { + use_dds_ = true; + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-debug")))) + { + std::istringstream istr (arg); + + if (!(istr >> debug_level_)) + { + return false; + } + + as.consume_arg (); + } + else + { + as.ignore_arg (); + } + } + + this->set_debug_level (); + + return true; +} + +std::string +AppOptions::host_id (void) const +{ + return host_id_; +} + +std::string +AppOptions::host_monitor_ior (void) const +{ + return host_monitor_ior_; +} + +u_short +AppOptions::port (void) const +{ + return port_; +} + +std::string +AppOptions::object_info_file (void) const +{ + return object_info_file_; +} + +std::string +AppOptions::process_id (void) const +{ + return process_id_; +} + +void +AppOptions::monitor (AppSideMonitor_Thread *mon) +{ + this->monitor_.reset (mon); +} + +std::string +AppOptions::app_id (void) const +{ + return app_id_; +} + +size_t +AppOptions::role (void) const +{ + return role_; +} + +double +AppOptions::load (void) const +{ + return load_; +} + +bool +AppOptions::use_dds (void) const +{ + return use_dds_; +} + +void +AppOptions::process_id (const std::string & id) +{ + process_id_ = id; +} + +void +AppOptions::set_debug_level (void) +{ + u_long mask = LM_EMERGENCY | LM_ALERT | LM_CRITICAL | LM_ERROR; + + switch (debug_level_) + { + case 0: break; + case 1: + { + mask |= LM_WARNING; + break; + } + case 2: + { + mask |= LM_WARNING | LM_DEBUG; + break; + } + case 3: + { + mask |= LM_WARNING | LM_DEBUG | LM_TRACE; + break; + } + case 4: + { + mask |= LM_WARNING | LM_DEBUG | LM_TRACE | LM_NOTICE; + break; + } + case 5: + { + mask |= LM_WARNING | LM_DEBUG | LM_TRACE | LM_NOTICE | LM_INFO; + break; + } + default: break; + } + + ACE_LOG_MSG->priority_mask (mask, + ACE_Log_Msg::PROCESS); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppOptions.h b/TAO/orbsvcs/orbsvcs/LWFT/AppOptions.h new file mode 100644 index 00000000000..1d1326d5ca0 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppOptions.h @@ -0,0 +1,89 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file AppOptions.h + * + * @brief Declared the AppOptions class interface. + * + */ + +#ifndef _APPOPTIONS_H +#define _APPOPTIONS_H + +#include <string> + +#include "ace/Thread_Mutex.h" +#include "ace/Auto_Ptr.h" + +#include "AppSideMonitor_Thread.h" +#include "lwft_server_export.h" + +/** + * @class AppOptions + * + * @brief Declares AppOptions singleton to hold the command line options. + */ + +class LWFT_Server_Export AppOptions +/// TITLE +/// Singleton class for the program options. +{ +public: + /// Singleton access method. + static AppOptions *instance (void); + + ~AppOptions (void); + + bool parse_args (int &argc, char **argv); + + /// Member accessors. + std::string host_id (void) const; + std::string host_monitor_ior (void) const; + u_short port (void) const; + std::string object_info_file (void) const; + std::string process_id (void) const; + void monitor (AppSideMonitor_Thread *mon); + std::string app_id (void) const; + size_t role (void) const; + double load (void) const; + bool use_dds (void) const; + + /** + * @return the debug level of the application: + * 0 - all errors and other urgent levels + * 1 - warnings are shown as well + * 2 - LM_DEBUG messages added + * 3 - LM_TRACE messages added + * 4 - LM_NOTICE messages added + * 5 - LM_INFO messages added + */ + long debug_level (void) const; + + void process_id (const std::string & id); + +protected: + /// Constructor is protected to ensure Singleton access. + AppOptions (void); + + void set_debug_level (void); + + std::string host_monitor_ior_; + std::string host_id_; + u_short port_; + std::string object_info_file_; + std::string process_id_; + std::string app_id_; + size_t role_; + double load_; + bool use_dds_; + long debug_level_; + std::auto_ptr <AppSideMonitor_Thread> monitor_; + + /// Singleton-related stuff. + static AppOptions * volatile instance_; + static ACE_Auto_Ptr<AppOptions> deleter_; + static ACE_Thread_Mutex lock_; +}; + +#endif /* _APPOPTIONS_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.cpp b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.cpp new file mode 100644 index 00000000000..1eb540dbf9a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.cpp @@ -0,0 +1,44 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file C++ Implementation: AppSideMonitor_Handler + * + * @brief Defines implementation of AppSideMonitor_Handler. + * + */ + +#include "AppSideMonitor_Handler.h" +#include <iostream> + +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 <FactoryAcceptor *> (factory); +// acceptor_->close(); + return super::open (factory); +} + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.h b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.h new file mode 100644 index 00000000000..3f8f5cb8623 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Handler.h @@ -0,0 +1,43 @@ +// -*- C++ -*- +// $Id$ + +/** + * @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 <ACE_SOCK_Acceptor::PEER_STREAM, ACE_NULL_SYNCH> +{ + public: + + typedef ACE_Svc_Handler <ACE_SOCK_Acceptor::PEER_STREAM, ACE_NULL_SYNCH> super; + typedef ACE_Acceptor <AppSideMonitor_Handler, ACE_SOCK_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/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp new file mode 100644 index 00000000000..4b6ba6a7912 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp @@ -0,0 +1,83 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file C++ Implementation: AppSideMonitor_Thread + * + * @brief Defines implementation of AppSideMonitor_Thread. + * + */ + +#include "ace/TP_Reactor.h" + +#include "Barrier_Guard.h" + +#include "AppSideMonitor_Thread.h" +#include "AppOptions.h" + +AppSideMonitor_Thread::AppSideMonitor_Thread ( + ACE_Barrier &thread_barrier) + : port_ (AppOptions::instance ()->port ()), + reactor_ (new ACE_TP_Reactor), + acceptor_ (serv_addr_, &reactor_), + synchronizer_ (thread_barrier) +{ +} + +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) +{ + { + Barrier_Guard barrier_guard (synchronizer_); + + if (serv_addr_.set (this->port_) == -1) + { + ACE_DEBUG ((LM_ERROR, + "AppSideMonitor_Thread::svc: can't set port.\n")); +// this->synchronizer_->wait (); + return EXIT_FAILURE; + } + + if (acceptor_.open (serv_addr_) == -1) + { + ACE_DEBUG ((LM_ERROR, + "AppSideMonitor_Thread::svc: can't open the socket.\n")); +// this->synchronizer_->wait (); + return EXIT_FAILURE; + } + + } // release synchronizer here + +// 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 (void) +{ + if (reactor_.end_reactor_event_loop() == -1) + { + ACE_DEBUG ((LM_ERROR, + "end_reactor_event_loop failed\n")); + } +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h new file mode 100644 index 00000000000..f18ae892b2d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h @@ -0,0 +1,49 @@ +// -*- C++ -*- +// $Id$ + +/** + * @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); + + AppSideMonitor_Thread (ACE_Barrier &thread_barrier, + u_short port); + + void stop (void); + virtual int svc (void); + +private: + u_short port_; + ACE_SOCK_Acceptor::PEER_ADDR serv_addr_; + ACE_Reactor reactor_; + ACE_Acceptor<AppSideMonitor_Handler, ACE_SOCK_Acceptor> acceptor_; + ACE_Barrier &synchronizer_; +}; + + + +#endif /// __APPSIDEMONITOR_THREAD_H_ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppSideReg.cpp b/TAO/orbsvcs/orbsvcs/LWFT/AppSideReg.cpp new file mode 100644 index 00000000000..1fd659402e7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppSideReg.cpp @@ -0,0 +1,148 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file C++ Implementation: AppSideReg + * + * @brief Defines implementation of AppSideReg. + * + */ +#include "ace/Barrier.h" + +#include "AppSideReg.h" +#include "AppOptions.h" + +AppSideReg::AppSideReg (CORBA::ORB_ptr orb) + : HM_ior_ (AppOptions::instance ()->host_monitor_ior ()), + orb_ (CORBA::ORB::_duplicate (orb)) +{ +} + +AppSideReg::~AppSideReg (void) +{ + // Now that this class is no longer a thread, the line below + // will have to appear somewhere else. +// monitor_->stop (); +} + +int +AppSideReg::register_process (void) +{ + try + { + CORBA::Object_var obj = orb_->string_to_object (HM_ior_.c_str()); + + if (CORBA::is_nil (obj)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "AppSideReg::svc: nil HM reference\n"), + 1); + } + + /// Downcast the object reference to a reference of type HostMonitor. + this->hmvar_ = HostMonitor::_narrow (obj); + + if (CORBA::is_nil (hmvar_)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "AppSideReg::svc: HostMonitor " + "narrow failed.\n"), + 1); + } + + // retrieve the heartbeat port number from the HostMonitor if no + // port parameter has been given. + if (AppOptions::instance ()->port () == 0) + { + try + { + port_ = hmvar_->heartbeat_port (); + } + catch (CORBA::SystemException &) + { + ACE_ERROR_RETURN ((LM_ERROR, + "AppSideReg::svc: HostMonitor " + "heartbeat_port () call failed.\n"), + 1); + } + } + else + { + port_ = AppOptions::instance ()->port (); + } + + ACE_DEBUG ((LM_TRACE, + "AppSideReg: creating the host monitor\n")); + + ACE_Barrier internal_thread_barrier (2); + AppSideMonitor_Thread *mon = + new AppSideMonitor_Thread (internal_thread_barrier, + port_); + + mon->activate (); + + //ACE_DEBUG ((LM_TRACE, "Host monitor activated\n")); + + internal_thread_barrier.wait (); + + // Store monitor in singleton so it will stay around. + AppOptions::instance ()->monitor (mon); + + //ACE_DEBUG ((LM_TRACE, "AppSideReg::svc before registering process.\n")); + + try + { + //ACE_DEBUG ((LM_TRACE, "AppSideReg::svc - got heartbeat port %d from hm.\n", port_)); + CORBA::Boolean good_register = + hmvar_->register_process ( + AppOptions::instance ()->process_id ().c_str (), + AppOptions::instance ()->host_id ().c_str (), + port_); + + if (good_register) + { + /* + ACE_DEBUG ((LM_TRACE, + "Registered successfully %s with host monitor.\n", + AppOptions::instance()->process_id().c_str())); + */ + } + else + { + ACE_DEBUG ((LM_ERROR, + "Registeration with the monitor failed. Maybe the " + "hostmonitor needs to be set to another " + "port range.\n")); + } + } + catch (CORBA::Exception &) + { + ACE_DEBUG ((LM_ERROR, + "AppSideReg: exception from register_process.\n")); + throw; + } + + //ACE_DEBUG ((LM_DEBUG, "Registering process\n")); + } + catch (CORBA::Exception &ex) + { + ACE_PRINT_EXCEPTION (ex, + "AppSideReg: A CORBA exception was raised:"); + return -1; + } + catch (...) + { + ACE_DEBUG ((LM_ERROR, "AppSideReg: Unknown exception raised!")); + return -1; + } + + return 0; +} + +void +AppSideReg::unregister_process (void) +{ + hmvar_->unregister_process ( + AppOptions::instance ()->process_id ().c_str ()); +} + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppSideReg.h b/TAO/orbsvcs/orbsvcs/LWFT/AppSideReg.h new file mode 100644 index 00000000000..c48da403eaf --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppSideReg.h @@ -0,0 +1,44 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file C++ Interface: AppSideReg + * + * @brief Declares interface for AppSideReg. + * + */ + +#ifndef __APPSIDEREG_H_ +#define __APPSIDEREG_H_ + +#include <string> + +#include "HostMonitorC.h" + +/** + * @class AppSideReg + * + * @brief Encapsulates AppSideReg + */ + +class LWFT_Server_Export AppSideReg +{ +public: + AppSideReg (CORBA::ORB_ptr); + + ~AppSideReg (void); + + int register_process (void); + + void unregister_process (void); + +private: + u_short port_; + std::string HM_ior_; + HostMonitor_var hmvar_; + CORBA::ORB_var orb_; +}; + + + +#endif /// __APPSIDEREG_H_ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Barrier_Guard.cpp b/TAO/orbsvcs/orbsvcs/LWFT/Barrier_Guard.cpp new file mode 100644 index 00000000000..6ab3ff77202 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Barrier_Guard.cpp @@ -0,0 +1,16 @@ +// -*- C++ -*- +// $Id$ + +#include "ace/Barrier.h" + +#include "Barrier_Guard.h" + +Barrier_Guard::Barrier_Guard (ACE_Barrier &barrier) + : barrier_ (barrier) +{ +} + +Barrier_Guard::~Barrier_Guard (void) +{ + barrier_.wait (); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Barrier_Guard.h b/TAO/orbsvcs/orbsvcs/LWFT/Barrier_Guard.h new file mode 100644 index 00000000000..bea774e890d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Barrier_Guard.h @@ -0,0 +1,43 @@ +// -*- C++ -*- +// $Id$ + +//============================================================ +/** + * @file Barrier_Guard.h + * + * Utility class to ensure that wait() is called on an + * ACE_Barrier at the end of a function body no matter + * what path is taken. + * + * @authors Jeff Parsons <j.parsons@vanderbilt.edu> + * Friedhelm Wolf <fwolf@dre.vanderbilt.edu> + */ +//============================================================ + +#ifndef BARRIER_GUARD_H +#define BARRIER_GUARD_H + +#include /**/ "ace/pre.h" + +#include "lwft_common_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class ACE_Barrier; + +class LWFT_Common_Export Barrier_Guard +{ +public: + Barrier_Guard (ACE_Barrier &barrier); + ~Barrier_Guard (void); + +private: + ACE_Barrier &barrier_; +}; + +#include /**/ "ace/post.h" + +#endif // BARRIER_GUARD_H + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.cpp b/TAO/orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.cpp new file mode 100644 index 00000000000..d5f87726f54 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.cpp @@ -0,0 +1,53 @@ +// -*- C++ -*- +// $Id$ + +#include "Client_ORBInitializer.h" + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "Client_Request_Interceptor.h" + +#include "tao/ORB_Constants.h" +#include "ace/OS_NS_string.h" + +Client_ORBInitializer::Client_ORBInitializer (ForwardingAgent_i *agent) + : agent_ (agent) +{ +} + +Client_ORBInitializer::~Client_ORBInitializer (void) +{ +} + +void +Client_ORBInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr) +{ +} + +void +Client_ORBInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info) +{ + CORBA::String_var orb_id = info->orb_id (); + + PortableInterceptor::ClientRequestInterceptor_ptr interceptor = + PortableInterceptor::ClientRequestInterceptor::_nil (); + + // Install the client request interceptor. + ACE_NEW_THROW_EX (interceptor, + Client_Request_Interceptor (orb_id.in (), agent_), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + ENOMEM), + CORBA::COMPLETED_NO)); + + PortableInterceptor::ClientRequestInterceptor_var + client_interceptor = interceptor; + + info->add_client_request_interceptor (client_interceptor.in ()); + +} + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.h b/TAO/orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.h new file mode 100644 index 00000000000..31f5da87e55 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Client_ORBInitializer.h @@ -0,0 +1,57 @@ +// -*- C++ -*- +// $Id$ + +#ifndef TAO_CLIENT_ORB_INITIALIZER_H +#define TAO_CLIENT_ORB_INITIALIZER_H + +#include /**/ "ace/pre.h" + +#include "tao/PI/PI.h" + +#include "lwft_client_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if TAO_HAS_INTERCEPTORS == 1 + +#include "tao/LocalObject.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class ForwardingAgent_i; + +/// Client side ORB initializer. +class LWFT_Client_Export Client_ORBInitializer + : public virtual PortableInterceptor::ORBInitializer, + public virtual TAO_Local_RefCounted_Object +{ +public: + + Client_ORBInitializer (ForwardingAgent_i *agent); + + ~Client_ORBInitializer (void); + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info); + +private: + ForwardingAgent_i *agent_; +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* TAO_HAS_INTERCEPTORS == 1 */ + +#include /**/ "ace/post.h" + +#endif /* TAO_CLIENT_ORB_INITIALIZER_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.cpp b/TAO/orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.cpp new file mode 100644 index 00000000000..6ca04cf7265 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.cpp @@ -0,0 +1,104 @@ +// -*- C++ -*- +// $Id$ + +#include "Client_Request_Interceptor.h" + +#include "ace/Log_Msg.h" + +#include "ForwardingAgent.h" + +Client_Request_Interceptor::Client_Request_Interceptor ( + const char *orb_id, + ForwardingAgent_i *agent) + : orb_id_ (CORBA::string_dup (orb_id)), + orb_ (), + request_count_ (0), + agent_ (agent) +{ +} + +char * +Client_Request_Interceptor::name (void) +{ + return CORBA::string_dup ("Client_Request_Interceptor"); +} + +void +Client_Request_Interceptor::destroy (void) +{ +} + +void +Client_Request_Interceptor::send_request ( + PortableInterceptor::ClientRequestInfo_ptr /* ri */) +{ + /* + ACE_DEBUG ((LM_INFO, + ACE_TEXT("(%P|%t) Client_Request_Interceptor::send_request (%s)\n"), + ri->operation ())); + */ +} + +void +Client_Request_Interceptor::send_poll ( + PortableInterceptor::ClientRequestInfo_ptr) +{ +} + +void +Client_Request_Interceptor::receive_reply ( + PortableInterceptor::ClientRequestInfo_ptr /* ri */) +{ + /* + ACE_DEBUG ((LM_INFO, + ACE_TEXT("(%P|%t) Client_Request_Interceptor::receive_reply (%s)\n"), + ri->operation ())); + */ +} + +void +Client_Request_Interceptor::receive_exception ( + PortableInterceptor::ClientRequestInfo_ptr ri) +{ + if (ACE_OS::strcmp (ri->received_exception_id (), + "IDL:omg.org/CORBA/COMM_FAILURE:1.0") != 0 + && ACE_OS::strcmp (ri->received_exception_id (), + "IDL:omg.org/CORBA/TRANSIENT:1.0") != 0) + { + return; + } +/* + ACE_DEBUG ((LM_DEBUG, + "Client_Request_Interceptor::receive_exception - " + "caught %s\n", + ri->received_exception_id ())); +*/ + const CORBA::ULong tagID = 9654; + char *tag = 0; + + try + { + IOP::TaggedComponent_var mytag = ri->get_effective_component (tagID); + tag = reinterpret_cast <char *> ( mytag->component_data.get_buffer ()); + ACE_CString new_string = CORBA::string_dup (tag); + CORBA::Object_var forward = this->agent_->next_member (tag); + ACE_THROW (PortableInterceptor::ForwardRequest (forward.in ())); + } + catch (CORBA::BAD_PARAM&) + { + ACE_DEBUG ((LM_DEBUG, + "Client_Request_Interceptor::receive_exception - " + "Tagged Component not found\n")); + } +} + +void +Client_Request_Interceptor::receive_other ( + PortableInterceptor::ClientRequestInfo_ptr /* ri */) +{ + /* + ACE_DEBUG ((LM_INFO, + ACE_TEXT("(%P|%t) Client_Request_Interceptor::receive_other (%s)\n"), + ri->operation ())); + */ +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.h b/TAO/orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.h new file mode 100644 index 00000000000..343c7cb622f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Client_Request_Interceptor.h @@ -0,0 +1,86 @@ +// -*- C++ -*- +// $Id$ + +#ifndef CLIENT_REQUEST_INTERCEPTOR_H +#define CLIENT_REQUEST_INTERCEPTOR_H + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PI/PI.h" +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" +#include "tao/ORB.h" +#include "tao/CORBA_String.h" + +#include "lwft_client_export.h" + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class ForwardingAgent_i; + +class LWFT_Client_Export Client_Request_Interceptor + : public virtual PortableInterceptor::ClientRequestInterceptor, + public virtual TAO_Local_RefCounted_Object +{ +public: + + /// Constructor. + Client_Request_Interceptor (const char *orb_id, ForwardingAgent_i *agent); + + /** + * @name Methods Required by the Client Request Interceptor + * Interface + * + * These are methods that must be implemented since they are pure + * virtual in the abstract base class. They are the canonical + * methods required for all client request interceptors. + */ + //@{ + /// Return the name of this ClientRequestinterceptor. + virtual char * name (void); + + virtual void destroy (void); + + virtual void send_request ( + PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void send_poll ( + PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_reply ( + PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_exception ( + PortableInterceptor::ClientRequestInfo_ptr ri); + + virtual void receive_other ( + PortableInterceptor::ClientRequestInfo_ptr ri); + //@} + +private: + + ///The ID of the ORB this interceptor is registered with. + CORBA::String_var orb_id_; + + /// Pseudo-reference to the ORB this interceptor is registered + /// with. + CORBA::ORB_var orb_; + + /// The number of requests intercepted by this interceptor. + CORBA::ULong request_count_; + + ForwardingAgent_i *agent_; +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* CLIENT_REQUEST_INTERCEPTOR_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.cpp b/TAO/orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.cpp new file mode 100644 index 00000000000..15980406041 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.cpp @@ -0,0 +1,35 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CorbaStateUpdate.cpp + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#include "CorbaStateUpdate.h" +#include "ReplicatedApplicationC.h" + +CorbaStateUpdate::CorbaStateUpdate(CORBA::Object_ptr application) + : application_ (CORBA::Object::_duplicate (application)) +{ +} + +CorbaStateUpdate::~CorbaStateUpdate() +{ +} + +void +CorbaStateUpdate::set_state (const ::CORBA::Any & state_value) +{ + if (!CORBA::is_nil (application_.in ())) + { + ReplicatedApplication_var ra = + ReplicatedApplication::_narrow (application_.in ()); + + ra->set_state (state_value); + } +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.h b/TAO/orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.h new file mode 100644 index 00000000000..e701b26dbd2 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/CorbaStateUpdate.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CorbaStateUpdate.h + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _CORBA_STATE_UPDATE_H_ +#define _CORBA_STATE_UPDATE_H_ + +#include "StatefulObject.h" +#include "tao/Object.h" + +/** + * @class CorbaStateUpdate + * + * @brief Implementation of the StatefulObject interface that uses + * a ReplicatedApplication CORBA object to disseminate state information + */ +class CorbaStateUpdate : public StatefulObject +{ +public: + + /// ctor + CorbaStateUpdate (CORBA::Object_ptr application); + + /// dtor + virtual ~CorbaStateUpdate (); + + /// method to set the + virtual void set_state (const ::CORBA::Any & state_value); + +private: + CORBA::Object_var application_; +}; + +#endif /* _CORBA_STATE_UPDATE_H_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/DDSFailure.cpp b/TAO/orbsvcs/orbsvcs/LWFT/DDSFailure.cpp new file mode 100644 index 00000000000..300e2791503 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/DDSFailure.cpp @@ -0,0 +1,28 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DDSFailure.cpp + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#include "DDSFailure.h" + +#if defined (FLARE_USES_DDS) + +DDSFailure::DDSFailure (const std::string & description) + : description_ (description) +{ +} + +std::string +DDSFailure::description (void) const +{ + return description_; +} + +#endif // FLARE_USES_DDS diff --git a/TAO/orbsvcs/orbsvcs/LWFT/DDSFailure.h b/TAO/orbsvcs/orbsvcs/LWFT/DDSFailure.h new file mode 100644 index 00000000000..b7ff2b497dc --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/DDSFailure.h @@ -0,0 +1,36 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DDSFailure.h + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _DDS_FAILURE_H_ +#define _DDS_FAILURE_H_ + +#if defined (FLARE_USES_DDS) + +#include <string> +#include "ssa_export.h" + +class SSA_Export DDSFailure +{ + public: + DDSFailure (const std::string & description); + + /// Getter method. + std::string description (void) const; + + private: + /// Description of what DDS problem occurred. + std::string description_; +}; + +#endif // FLARE_USES_DDS + +#endif /* _DDS_FAILURE_H_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.cpp b/TAO/orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.cpp new file mode 100644 index 00000000000..3e0463c1b8e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.cpp @@ -0,0 +1,180 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DDSStateReaderListener_T.cpp + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _DDS_STATE_READER_LISTENER_T_CPP_ +#define _DDS_STATE_READER_LISTENER_T_CPP_ + +template <typename DATA_TYPE> +DDSStateReaderListener_T<DATA_TYPE>::DDSStateReaderListener_T ( + const std::string & id, + ReplicatedApplication_ptr application) + : id_ (id), + application_ (ReplicatedApplication::_duplicate (application)) +{ +} + +template <typename DATA_TYPE> +DDSStateReaderListener_T<DATA_TYPE>::~DDSStateReaderListener_T (void) +{ +} + +template <typename DATA_TYPE> +void +DDSStateReaderListener_T<DATA_TYPE>::on_requested_deadline_missed ( + DDS::DataReader_ptr, + const DDS::RequestedDeadlineMissedStatus &) + throw (CORBA::SystemException) +{ + ACE_DEBUG ((LM_TRACE, + ACE_TEXT ("DDSStateReaderListener_T::") + ACE_TEXT ("on_requested_deadline_missed ()\n"))); +} + +template <typename DATA_TYPE> +void +DDSStateReaderListener_T<DATA_TYPE>::on_requested_incompatible_qos ( + DDS::DataReader_ptr, + const DDS::RequestedIncompatibleQosStatus &status) + throw (CORBA::SystemException) +{ + ACE_DEBUG ((LM_TRACE, + ACE_TEXT ("DDSStateReaderListener_T::") + ACE_TEXT ("on_requested_incompatible_qos ()") + ACE_TEXT ("count=%d id=%d\n"), + status.total_count_change, + status.last_policy_id)); +} + +template <typename DATA_TYPE> +void +DDSStateReaderListener_T<DATA_TYPE>::on_liveliness_changed ( + DDS::DataReader_ptr, + const DDS::LivelinessChangedStatus &) + throw (CORBA::SystemException) +{ +} + +template <typename DATA_TYPE> +void +DDSStateReaderListener_T<DATA_TYPE>::on_subscription_matched ( + DDS::DataReader_ptr, + const DDS::SubscriptionMatchedStatus &) + throw (CORBA::SystemException) +{ +} + +template <typename DATA_TYPE> +void +DDSStateReaderListener_T<DATA_TYPE>::on_sample_rejected ( + DDS::DataReader_ptr, + const DDS::SampleRejectedStatus &) + throw (CORBA::SystemException) +{ + ACE_DEBUG ((LM_TRACE, + ACE_TEXT ("DDSStateReaderListener_T::") + ACE_TEXT ("on_sample_rejected ()\n"))); +} + +template <typename DATA_TYPE> +void +DDSStateReaderListener_T<DATA_TYPE>::on_data_available ( + DDS::DataReader_ptr reader) + throw (CORBA::SystemException) +{ + typename DATA_TYPE::_data_reader_type::_var_type state_dr = + DATA_TYPE::_data_reader_type::_narrow (reader); + + if (CORBA::is_nil (state_dr.in ())) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("on_data_available(): ") + ACE_TEXT ("DDSStateReaderListener_T::_narrow() failed.\n"))); + } + + typename DATA_TYPE::_seq_type state_samples; + DDS::SampleInfoSeq sis; + + DDS::ReturnCode_t status = + state_dr->take (state_samples, + sis, + 1, + DDS::NOT_READ_SAMPLE_STATE, + DDS::ANY_VIEW_STATE, + DDS::ANY_INSTANCE_STATE); + + if (status == DDS::RETCODE_OK) + { + if (state_samples.length () > 0) + { + DATA_TYPE state_sample = state_samples[0]; + DDS::SampleInfo si = sis[0]; +/* + ACE_DEBUG ((LM_TRACE, + ACE_TEXT ("DDSStateReaderListener_T ") + ACE_TEXT ("sample-id %s\n"), + state_sample.id.in ())); +*/ + // Update the state only if it is not + // sent from within the same process. + if (id_.compare (state_sample.id) != 0) + { + // Put state information into an any + // and send it to the application. + CORBA::Any_var state (new CORBA::Any); + + // Insert state value into the any. + *state <<= state_sample; + + try + { + application_->set_state (state.in ()); + } + catch (CORBA::SystemException & ex) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("on_data_available(): ") + ACE_TEXT ("could not send state information ") + ACE_TEXT ("to application: %s"), + ex._info ().c_str ())); + } + } + } + } + else if (status == DDS::RETCODE_NO_DATA) + { + /* + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("on_data_available(): ") + ACE_TEXT ("reader received DDS::RETCODE_NO_DATA.\n"))); + */ + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("on_data_available(): ") + ACE_TEXT ("reader error: %d.\n"), status)); + } +} + +template <typename DATA_TYPE> +void +DDSStateReaderListener_T<DATA_TYPE>::on_sample_lost ( + DDS::DataReader_ptr, + const DDS::SampleLostStatus &) + throw (CORBA::SystemException) +{ + ACE_DEBUG ((LM_TRACE, + ACE_TEXT ("DDSStateReaderListener_T::") + ACE_TEXT ("on_sample_lost ()\n"))); +} + +#endif /* _DDS_STATE_READER_LISTENER_T_CPP_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.h b/TAO/orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.h new file mode 100644 index 00000000000..18e8b0f5470 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/DDSStateReaderListener_T.h @@ -0,0 +1,81 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DDSStateReaderListener_T.h + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _DDS_STATE_READER_LISTENER_T_H_ +#define _DDS_STATE_READER_LISTENER_T_H_ + +#include "ccpp.h" +#include "ReplicatedApplicationC.h" + +/** + * @class DDSStateReaderListener_T + * + * @brief this listener receives data from DDS and posts it to the replicated + * application. + */ +template <typename DATA_TYPE> +class DDSStateReaderListener_T : public DDS::DataReaderListener +{ +public: + /// ctor + DDSStateReaderListener_T (const std::string & id, + ReplicatedApplication_ptr application); + + /// dtor + virtual ~DDSStateReaderListener_T (void); + + virtual void + on_requested_deadline_missed ( + DDS::DataReader_ptr reader, + const DDS::RequestedDeadlineMissedStatus & status) + throw (CORBA::SystemException); + + virtual void on_requested_incompatible_qos ( + DDS::DataReader_ptr reader, + const DDS::RequestedIncompatibleQosStatus & status) + throw (CORBA::SystemException); + + virtual void on_liveliness_changed ( + DDS::DataReader_ptr reader, + const DDS::LivelinessChangedStatus & status) + throw (CORBA::SystemException); + + virtual void on_subscription_matched ( + DDS::DataReader_ptr reader, + const DDS::SubscriptionMatchedStatus & status) + throw (CORBA::SystemException); + + virtual void on_sample_rejected ( + DDS::DataReader_ptr reader, + const DDS::SampleRejectedStatus& status) + throw (CORBA::SystemException); + + virtual void on_data_available ( + DDS::DataReader_ptr reader) + throw (CORBA::SystemException); + + virtual void on_sample_lost ( + DDS::DataReader_ptr reader, + const DDS::SampleLostStatus& status) + throw (CORBA::SystemException); + +private: + /// This id is part of every topic to check where the data comes from. + std::string id_; + + /// Reference of the application receiving the state information. + ReplicatedApplication_var application_; +}; + +#include "DDSStateReaderListener_T.cpp" + +#endif /* _DDS_STATE_READER_LISTENER_T_H_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.cpp b/TAO/orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.cpp new file mode 100644 index 00000000000..cdaf465c2d5 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.cpp @@ -0,0 +1,262 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DDSStateUpdate_T.cpp + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _DDS_STATE_UPDATE_T_CPP_ +#define _DDS_STATE_UPDATE_T_CPP_ + +#include "ccpp_dds_dcps.h" +#include "DDSStateReaderListener_T.h" +#include "DDSFailure.h" + +template <typename DATA_TYPE> +DDSStateUpdate_T<DATA_TYPE>::DDSStateUpdate_T ( + const std::string & topic_name, + const std::string & id, + DDS::DomainParticipant_ptr participant, + DDS::Publisher_ptr publisher, + DDS::Subscriber_ptr subscriber, + ReplicatedApplication_ptr application) + : topic_name_ (topic_name), + id_ (id), + participant_ (DDS::DomainParticipant::_duplicate (participant)), + pub_ (DDS::Publisher::_duplicate (publisher)), + sub_ (DDS::Subscriber::_duplicate (subscriber)), + topic_ (DDS::Topic::_nil ()), + datawriter_ (DATA_TYPE::_data_writer_type::_nil ()), + datareader_ (DATA_TYPE::_data_reader_type::_nil ()), + listener_ (new DDSStateReaderListener_T <DATA_TYPE> (id, application)) +{ + id_ = id.c_str (); + this->init (); +} + +template <typename DATA_TYPE> +DDSStateUpdate_T<DATA_TYPE>::~DDSStateUpdate_T (void) +{ + this->fini (); +} + +template <typename DATA_TYPE> +bool +DDSStateUpdate_T<DATA_TYPE>::init (void) +{ + if (!this->create_topic ()) + { + throw (DDSFailure ("Could not create topic\n")); + } + + if (!this->create_datawriter ()) + { + throw (DDSFailure ("Could not create datawriter\n")); + } + + if (!this->create_datareader ()) + { + throw (DDSFailure ("Could not create datareader\n")); + } + + return true; +} + +template <typename DATA_TYPE> +bool +DDSStateUpdate_T<DATA_TYPE>::fini (void) +{ + DDS::ReturnCode_t status = + this->pub_->delete_datawriter (this->datawriter_.in ()); + + if (status != DDS::RETCODE_OK) + { + return false; + } + + status = this->participant_->delete_topic (this->topic_.in ()); + + if (status != DDS::RETCODE_OK) + { + return false; + } + + return true; +} + +template <typename DATA_TYPE> +void +DDSStateUpdate_T<DATA_TYPE>::set_state ( + const CORBA::Any & state_value) +{ + // Extract value from any. + const DATA_TYPE * value = 0; + + // Update value on state topic sample, but make sure to + // set the 'id' field with our unique string, since the + // extracted value of this member will be the empty string. + if (state_value >>= value) + { + state_ = *value; + state_.id = id_.c_str (); + } +/* + ACE_DEBUG ((LM_TRACE, + ACE_TEXT ("DDSStateUpdate_T::set_state writes sample " + "with id %s\n"), + state_.id.in ())); +*/ + // Publish value. + DDS::ReturnCode_t ret = + this->datawriter_->write (this->state_, + this->instance_handle_); + + if (ret == DDS::RETCODE_ALREADY_DELETED) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("DDSStateUpdate_T::set_state () " + ": write returned " + "RETCODE_ALREADY_DELETED.\n"), + ret)); + } + else if (ret != DDS::RETCODE_OK) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("DDSStateUpdate_T::set_state () " + ": write returned %d.\n"), + ret)); + } + +} + +template <typename DATA_TYPE> +bool +DDSStateUpdate_T<DATA_TYPE>::create_topic (void) +{ + DDS::TypeSupport_var ts = new typename DATA_TYPE::_type_support_type (); + CORBA::String_var data_type_name = ts->get_type_name (); + + DDS::ReturnCode_t status = + ts->register_type (this->participant_.in (), + data_type_name.in ()); + + if (status != DDS::RETCODE_OK) + { + return false; + } + + DDS::TopicQos default_topic_qos; + status = + this->participant_->get_default_topic_qos (default_topic_qos); + + if (status != DDS::RETCODE_OK) + { + return false; + } + + this->topic_ = + this->participant_->create_topic (topic_name_.c_str (), + data_type_name.in (), + default_topic_qos, + DDS::TopicListener::_nil (), + DDS::ANY_STATUS); + + if (CORBA::is_nil (this->topic_.in ())) + { + return false; + } + + return true; +} + +template <typename DATA_TYPE> +bool +DDSStateUpdate_T<DATA_TYPE>::create_datawriter (void) +{ + DDS::DataWriterQos dw_qos; + DDS::ReturnCode_t status = + pub_->get_default_datawriter_qos (dw_qos); + + // State synchronization should be reliable. + dw_qos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS; + + if (status != DDS::RETCODE_OK) + { + return false; + } + + DDS::DataWriter_var datawriter_base = + pub_->create_datawriter (this->topic_.in (), + dw_qos, + DDS::DataWriterListener::_nil (), + DDS::ANY_STATUS); + + if (CORBA::is_nil (datawriter_base.in ())) + { + return false; + } + + datawriter_ = + DATA_TYPE::_data_writer_type::_narrow (datawriter_base.in ()); + + if (CORBA::is_nil (datawriter_.in ())) + { + return false; + } + + // Since there is no key, we need only one + // instance handle for all writes. + instance_handle_ = + datawriter_->register_instance (state_); + + return true; +} + +template <typename DATA_TYPE> +bool +DDSStateUpdate_T<DATA_TYPE>::create_datareader (void) +{ + DDS::DataReaderQos dr_qos; + DDS::ReturnCode_t status = + sub_->get_default_datareader_qos (dr_qos); + + // State synchronization should be reliable. + dr_qos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS; + + if (status != DDS::RETCODE_OK) + { + return false; + } + + DDS::DataReader_var datareader_base = + sub_->create_datareader (topic_.in (), + dr_qos, + listener_.in (), + DDS::ANY_STATUS); + + if (CORBA::is_nil (datareader_base.in ())) + { + return false; + } + + datareader_ = + DATA_TYPE::_data_reader_type::_narrow (datareader_base.in ()); + + if (CORBA::is_nil (datareader_.in ())) + { + return false; + } +/* + ACE_DEBUG ((LM_TRACE, + ACE_TEXT ("created DataReader for %s\n"), + topic_name_.c_str ())); +*/ + return true; +} + +#endif /* _DDS_STATE_UPDATE_T_CPP_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.h b/TAO/orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.h new file mode 100644 index 00000000000..b437fcba06a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/DDSStateUpdate_T.h @@ -0,0 +1,82 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DDSStateUpdate_T.h + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _DDS_STATE_UPDATE_T_H_ +#define _DDS_STATE_UPDATE_T_H_ + +#include <string> +#include "ccpp.h" +#include "StatefulObject.h" +#include "ReplicatedApplicationC.h" + +/** + * @class DDSStateUpdate_T + * + * @brief Implementation of the StatefulObject interface that uses + * DDS to disseminate state information to replicas + */ +template <typename DATA_TYPE>//, +// typename DATA_TYPE_SUPPORT, +// typename DATA_WRITER, +// typename DATA_READER, +// typename DATA_TYPE_SEQUENCE> +class DDSStateUpdate_T : public StatefulObject +{ +public: + /// ctor + DDSStateUpdate_T (const std::string & topic_name, + const std::string & id, + DDS::DomainParticipant_ptr participant, + DDS::Publisher_ptr publisher, + DDS::Subscriber_ptr subscriber, + ReplicatedApplication_ptr application); + + /// dtor + virtual ~DDSStateUpdate_T (void); + + bool init (void); + bool fini (void); + + /// triggers state dissemination using DDS + virtual void set_state (const CORBA::Any & state_value); + +protected: + /// contains the value sent most recently + DATA_TYPE state_; + +private: + // Helper methods for DDS initialization. + bool create_topic (void); + bool create_datawriter (void); + bool create_datareader (void); + +private: + /// Name of the topic to be registered. + std::string topic_name_; + + /// This id is part of every topic to check where the data comes from. + std::string id_; + + // DDS entities needed for data dissemination. + DDS::DomainParticipant_var participant_; + DDS::Publisher_var pub_; + DDS::Subscriber_var sub_; + DDS::Topic_var topic_; + DDS::InstanceHandle_t instance_handle_; + typename DATA_TYPE::_data_writer_type::_var_type datawriter_; + typename DATA_TYPE::_data_reader_type::_var_type datareader_; + DDS::DataReaderListener_var listener_; +}; + +#include "DDSStateUpdate_T.cpp" + +#endif /* _DDS_STATE_UPDATE_T_H_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Failure_Handler.cpp b/TAO/orbsvcs/orbsvcs/LWFT/Failure_Handler.cpp new file mode 100644 index 00000000000..f2afe3aa075 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Failure_Handler.cpp @@ -0,0 +1,91 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file C++ Implementation: Failure_Handler + * + * @brief Defines implementation of Failure_Handler. + * + */ + +#include "Failure_Handler.h" +#include "HostMonitorImpl.h" + +ProcessInfo::ProcessInfo (const std::string &pid, const std::string &hn, size_t p) +: process_id (pid), + hostname (hn), + port (p) +{} + + +Failure_Handler::ProcessInfoMap Failure_Handler::process_map_; + +Failure_Handler::Failure_Handler () +: connector_factory_ (0), + host_monitor_ (0) +{} + +int Failure_Handler::handle_input (ACE_HANDLE fd) +{ + ProcessInfo pinfo; + + if (process_map_.find (fd, pinfo) == 0) /// if found + { + ACE_DEBUG ((LM_DEBUG, + "It looks like process %s has failed.\n", + pinfo.process_id.c_str())); + process_map_.unbind (fd); + + if (host_monitor_->drop_process (pinfo.process_id) == 0) + { + /// Release the handler. + return -1; + } + else + { + ACE_DEBUG ((LM_DEBUG, + "drop_process failed process_id = %s.\n", + pinfo.process_id.c_str())); + } + } + + return -1; +} + +void Failure_Handler::set_host_monitor (HostMonitorImpl *hm) +{ + host_monitor_ = hm; +} + +int Failure_Handler::open (void *factory) +{ + connector_factory_ = static_cast <FactoryConnector *> (factory); + return super::open (factory); +} + +int Failure_Handler::drop_process (ACE_HANDLE fd) +{ + ProcessInfo pinfo; + + if ((process_map_.find (fd, pinfo) == 0) && + (process_map_.unbind (fd) == 0)) + { + connector_factory_->reactor ()->remove_handler (this, super::ALL_EVENTS_MASK); + ACE_DEBUG ((LM_DEBUG, + "Record for process %s removed from the map.\n", + pinfo.process_id.c_str())); + return 0; + } + else + { + return -1; + } +} + +int Failure_Handler::watch_process (ACE_HANDLE fd, + const std::string &process_id, + const std::string &hostname, + size_t port) +{ + return process_map_.bind (fd, ProcessInfo (process_id, hostname, port)); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Failure_Handler.h b/TAO/orbsvcs/orbsvcs/LWFT/Failure_Handler.h new file mode 100644 index 00000000000..05fdb03ff63 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Failure_Handler.h @@ -0,0 +1,78 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file C++ Interface: Failure_Handler + * + * @brief Declares interface for Failure_Handler. + * + */ + +#ifndef __FAILURE_HANDLER_H_ +#define __FAILURE_HANDLER_H_ + +#include <string> + +#include "ace/Svc_Handler.h" +#include "ace/Map_Manager.h" +#include "ace/SOCK_Connector.h" +#include "ace/Connector.h" + +#include "host_monitor_export.h" + +struct ProcessInfo +{ + ProcessInfo () {} + ProcessInfo (const std::string &pid, + const std::string &hn, + size_t port); + + std::string process_id; + std::string hostname; + size_t port; +}; + +/** + * @class Failure_Handler + * + * @brief Encapsulates Failure_Handler + */ + +class HostMonitorImpl; + +class HostMonitor_Export Failure_Handler + : public ACE_Svc_Handler <ACE_SOCK_Connector::PEER_STREAM, ACE_NULL_SYNCH> +{ +public: + typedef ACE_Map_Manager <ACE_HANDLE, ProcessInfo, + ACE_Thread_Mutex> + ProcessInfoMap; + + typedef ACE_Svc_Handler <ACE_SOCK_Connector::PEER_STREAM, + ACE_NULL_SYNCH> + super; + + typedef ACE_Connector <super, ACE_SOCK_Connector> FactoryConnector; + + Failure_Handler (void); + + virtual int handle_input (ACE_HANDLE fd); + virtual int open (void *factory); + + void set_host_monitor (HostMonitorImpl *hm); + int watch_process (ACE_HANDLE fd, + const std::string &process_id, + const std::string &hostname, + size_t port); + int drop_process (ACE_HANDLE fd); + +private: + static ProcessInfoMap process_map_; + FactoryConnector *connector_factory_; + HostMonitorImpl *host_monitor_; +}; + + + + +#endif /// __FAILURE_HANDLER_H_ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/FaultNotification.idl b/TAO/orbsvcs/orbsvcs/LWFT/FaultNotification.idl new file mode 100644 index 00000000000..2ff7cfbd2cb --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/FaultNotification.idl @@ -0,0 +1,30 @@ +// $Id$ + +#ifndef FAULTNOTIFICATION_IDL +#define FAULTNOTIFICATION_IDL + +module FLARE { + + typedef sequence<string> ApplicationList; + + interface FaultNotification { + void app_failure (in string host, + in ApplicationList applications); + }; + + exception NotifyRegistrationError {}; + + typedef unsigned long NotificationId; + + interface FaultNotifier { + + NotificationId register_fault_notification (in FaultNotification receiver) + raises (NotifyRegistrationError); + + void unregister_fault_notification (in NotificationId id); + + }; + +}; + +#endif /* FAULTNOTIFICATION_IDL */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ForwardingAgent.cpp b/TAO/orbsvcs/orbsvcs/LWFT/ForwardingAgent.cpp new file mode 100644 index 00000000000..396e28aef2e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ForwardingAgent.cpp @@ -0,0 +1,98 @@ +// $Id$ + +#include "ForwardingAgent.h" + +ForwardingAgent_i::ForwardingAgent_i (bool proactive) + : proactive_ (proactive), + update_count_ (0) +{ +} + +ForwardingAgent_i::~ForwardingAgent_i (void) +{ +} + +void +ForwardingAgent_i::proactive (bool v) +{ + proactive_ = v; +} + +CORBA::Object_ptr +ForwardingAgent_i::next_member (const char *ior_string) +{ + // ACE_DEBUG ((LM_DEBUG, + // "FA: NEXT MEMBER CALLED for ior_string = %s.\n", + // ior_string)); + ACE_Guard <ACE_Thread_Mutex> guard (ior_map_mutex_); + + AGENT_RANKED_IOR_LIST ranked_ior_list; + + int result = + this->objectid_rankedior_map_.find (ACE_CString (ior_string), + ranked_ior_list); + + //size_t siz = ranked_ior_list.ior_list.size (); + //ACE_DEBUG ((LM_DEBUG, + // "next_member: IOR list size = %u\n", + // siz)); + + if ((result == 0) && (ranked_ior_list.ior_list.size () > 0)) + { + CORBA::Object_var ior (ranked_ior_list.ior_list.front ()); + ranked_ior_list.ior_list.pop_front (); + this->objectid_rankedior_map_.rebind (ACE_CString (ior_string), + ranked_ior_list); + return CORBA::Object::_duplicate (ior.in ()); + } + + ACE_ERROR_RETURN ((LM_ERROR, + "FA: No ior list entry for tag=%s!!!\n", + ior_string), + 0); +} + +void +ForwardingAgent_i::update_rank_list (const RankList & rank_list) +{ + ACE_Guard <ACE_Thread_Mutex> guard (ior_map_mutex_); + objectid_rankedior_map_.close (); + objectid_rankedior_map_.open (); + /* + ACE_DEBUG((LM_TRACE, + "ForwardingAgent - " + "Received rank_list length = %d.\n", + rank_list.length ())); + */ + for (size_t i = 0; i < rank_list.length (); ++i) + { + /* + ACE_DEBUG ((LM_TRACE, + "\toid(%s) = %d entries\n", + rank_list[i].object_id.in (), + rank_list[i].ior_list.length ())); + */ + AGENT_RANKED_IOR_LIST ranked_ior_list; + ranked_ior_list.now = rank_list[i].now; + + for (size_t j = 0; j < rank_list[i].ior_list.length (); ++j) + { + ranked_ior_list.ior_list.push_back ( + CORBA::Object::_duplicate (rank_list[i].ior_list[j])); + } + + ACE_CString oid (rank_list[i].object_id); + objectid_rankedior_map_.bind (oid, ranked_ior_list); + } +} + +void +ForwardingAgent_i::initialize (CORBA::Object_ptr rm_ior) +{ + this->RM_var_ = ReplicationManager::_narrow (rm_ior); + ForwardingAgent_var temp = this->_this (); + + //ACE_DEBUG ((LM_DEBUG, "FA: calling register agent\n")); + RankList *rank_list = this->RM_var_->register_agent (temp.in ()); + update_rank_list (*rank_list); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ForwardingAgent.h b/TAO/orbsvcs/orbsvcs/LWFT/ForwardingAgent.h new file mode 100644 index 00000000000..0f71384ead9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ForwardingAgent.h @@ -0,0 +1,51 @@ +// $Id$ + +#ifndef FORWARDINGAGENT_H +#define FORWARDINGAGENT_H + +#include "ForwardingAgentS.h" +#include "ReplicationManagerC.h" + +#include <list> + +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Unbounded_Queue.h" + +struct AGENT_RANKED_IOR_LIST +{ + bool now; + std::list<CORBA::Object_var> ior_list; +}; + + +class LWFT_Client_Export ForwardingAgent_i : public virtual POA_ForwardingAgent +{ +public: + ForwardingAgent_i (bool proactive = true); + + ~ForwardingAgent_i (void); + + virtual CORBA::Object_ptr next_member (const char * m); + + virtual void update_rank_list (const RankList & rank_list); + + void initialize (CORBA::Object_ptr); + void proactive (bool v); + + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + AGENT_RANKED_IOR_LIST, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> + OBJECTID_RANKED_IOR_MAP; + + +private: + ReplicationManager_var RM_var_; + OBJECTID_RANKED_IOR_MAP objectid_rankedior_map_; + ACE_Thread_Mutex ior_map_mutex_; + bool proactive_; + size_t update_count_; +}; + +#endif /* FORWARDINGAGENT_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ForwardingAgent.idl b/TAO/orbsvcs/orbsvcs/LWFT/ForwardingAgent.idl new file mode 100644 index 00000000000..19b68b88c33 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ForwardingAgent.idl @@ -0,0 +1,12 @@ +// +// $Id$ +// + +#include "LWFTDataStructures.idl" + +interface ForwardingAgent +{ + Object next_member (in string m); + void update_rank_list (in RankList rank_list); +}; + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.cpp b/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.cpp new file mode 100644 index 00000000000..f95a9116300 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.cpp @@ -0,0 +1,224 @@ +// -*- C++ -*- +// $Id$ + +#include <sstream> + +#include "ace/Global_Macros.h" +#include "ace/Guard_T.h" +#include "ace/Log_Msg.h" +#include "ace/Arg_Shifter.h" + +#include "HMOptions.h" + +/// Initialize the static data member. +HMOptions * volatile HMOptions::instance_ = 0; +ACE_Auto_Ptr<HMOptions> HMOptions::deleter_; +ACE_Thread_Mutex HMOptions::lock_; + +HMOptions::HMOptions (void) + : RM_ior_ ("file://rm.ior"), + HM_ior_file_ ("hm.ior"), + port_range_begin_ (7000), + RM_update_freq_ (1), + load_monitor_freq_(2), + debug_level_ (0) +{ + char hostname [100]; + gethostname (hostname, sizeof (hostname)); + host_id_ = hostname; +// ACE_DEBUG ((LM_DEBUG, "Hostname is %s.\n", hostname)); +} + +HMOptions * +HMOptions::instance (void) +{ + if (instance_ == 0) + { + ACE_GUARD_RETURN (ACE_Thread_Mutex, guard, lock_, 0); + + if (instance_ == 0) + { + instance_ = new HMOptions (); + deleter_.reset (instance_); + } + } + + return instance_; +} + +bool +HMOptions::parse_args (int &argc, char **argv) +{ + ACE_Arg_Shifter as (argc, argv); + + while (as.is_anything_left ()) + { + const ACE_TCHAR *arg = 0; + + if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-util_file")))) + { + util_file_ = arg; + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-ior_file")))) + { + HM_ior_file_ = arg; + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-rm_ior")))) + { + RM_ior_ = arg; + ior_access_ = std::make_pair ('i', RM_ior_); + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-rm_name")))) + { + RM_ior_ = arg; + ior_access_ = std::make_pair ('n', RM_ior_); + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-host_id")))) + { + host_id_ = arg; + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-port_range_begin")))) + { + std::istringstream istr (arg); + + if (!(istr >> port_range_begin_)) + { + return false; + } + + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-rm_update_freq")))) + { + std::istringstream istr (arg); + + if (!(istr >> RM_update_freq_)) + { + return false; + } + + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-load_mon_freq")))) + { + std::istringstream istr (arg); + + if (!(istr >> load_monitor_freq_)) + { + return false; + } + + as.consume_arg (); + } + else if (0 != (arg = as.get_the_parameter (ACE_TEXT ("-debug")))) + { + std::istringstream istr (arg); + + if (!(istr >> debug_level_)) + { + return false; + } + + as.consume_arg (); + } + else + { + as.ignore_arg (); + } + } + + return true; +}; + +std::string +HMOptions::HM_ior_file (void) const +{ + return HM_ior_file_; +} + +std::string +HMOptions::RM_ior (void) const +{ + return RM_ior_; +} + +std::string +HMOptions::host_id (void) const +{ + return host_id_; +} + +int +HMOptions::port_range_begin (void) const +{ + return port_range_begin_; +} + +int +HMOptions::RM_update_freq (void) const +{ + return RM_update_freq_; +} + +std::string +HMOptions::util_file (void) const +{ + return util_file_; +} + +int +HMOptions::load_monitor_freq (void) const +{ + return load_monitor_freq_; +} + +std::pair<char, std::string> +HMOptions::ior_access (void) const +{ + return ior_access_; +} + +void +HMOptions::set_debug_level (void) +{ + u_long mask = LM_EMERGENCY | LM_ALERT | LM_CRITICAL | LM_ERROR; + + switch (debug_level_) + { + case 0: break; + case 1: + { + mask |= LM_WARNING; + break; + } + case 2: + { + mask |= LM_WARNING | LM_DEBUG; + break; + } + case 3: + { + mask |= LM_WARNING | LM_DEBUG | LM_TRACE; + break; + } + case 4: + { + mask |= LM_WARNING | LM_DEBUG | LM_TRACE | LM_NOTICE; + break; + } + case 5: + { + mask |= LM_WARNING | LM_DEBUG | LM_TRACE | LM_NOTICE | LM_INFO; + break; + } + default: break; + } + + ACE_LOG_MSG->priority_mask (mask, + ACE_Log_Msg::PROCESS); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.h b/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.h new file mode 100644 index 00000000000..4cc93ea5c36 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/HMOptions.h @@ -0,0 +1,81 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file HMOptions.h + * + * @brief Declared the HMOptions class interface. + * + */ + +#ifndef _HMOPTIONS_H +#define _HMOPTIONS_H + +#include <string> + +#include "ace/Thread_Mutex.h" +#include "ace/Auto_Ptr.h" + +#include "host_monitor_export.h" + +/** + * @class HMOptions + * + * @brief Declares HMOptions singleton to hold the command line options. + */ + +class HostMonitor_Export HMOptions +/// TITLE +/// Singleton class for the program options. +{ +public: + /// Singleton access method. + static HMOptions *instance (void); + + bool parse_args (int &argc, char **argv); + + /// Member accessors. + std::string RM_ior (void) const; + std::string HM_ior_file (void) const; + std::string host_id (void) const; + int port_range_begin (void) const; + int RM_update_freq (void) const; + int load_monitor_freq (void) const; + std::string util_file (void) const; + std::pair <char, std::string> ior_access (void) const; + bool use_naming_service (void) const; + + /** + * @return the debug level of the application: + * 0 - all errors and other urgent levels + * 1 - warnings are shown as well + * 2 - LM_DEBUG messages added + * 3 - LM_TRACE messages added + * 4 - LM_NOTICE messages added + * 5 - LM_INFO messages added + */ + long debug_level (void) const; + +protected: + /// Constructor is protected to ensure Singleton access. + HMOptions (void); + + void set_debug_level (void); + + std::string RM_ior_; + std::string host_id_; + std::string HM_ior_file_; + std::string util_file_; + size_t port_range_begin_; + size_t RM_update_freq_; + size_t load_monitor_freq_; + std::pair <char, std::string> ior_access_; + long debug_level_; + + /// Singleton-related stuff. + static HMOptions * volatile instance_; + static ACE_Auto_Ptr<HMOptions> deleter_; + static ACE_Thread_Mutex lock_; +}; + +#endif /* _HMOPTIONS_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/HostMonitor.idl b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitor.idl new file mode 100644 index 00000000000..73778c715dc --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitor.idl @@ -0,0 +1,23 @@ +// -*- IDL -*- +// $Id$ + +#ifndef HOSTMONITOR_IDL +#define HOSTMONITOR_IDL + +interface HostMonitor +{ + boolean register_process (in string process_id, + in string hostname, + in long port); + boolean unregister_process (in string process_id); + + // returns a different port number every time on which the + // client shall then listen for heartbeats. This will be passed + // in by the client in the register_process call. + short heartbeat_port (); + + void dump (); +}; + +#endif // HOSTMONITOR_IDL + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp new file mode 100644 index 00000000000..ffa0a42c4b4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.cpp @@ -0,0 +1,179 @@ +// -*- C++ -*- +// $Id$ + +#include "ace/Connector.h" +#include "ace/Service_Object.h" +#include "ace/Reactor.h" +#include "ace/INET_Addr.h" +#include "ace/Time_Value.h" +#include "ace/Synch_Options.h" +#include "ace/Thread_Mutex.h" + +#include "HostMonitorImpl.h" +#include "Failure_Handler.h" +#include "Monitor_Thread.h" +#include "RM_Proxy.h" +#include "HMOptions.h" +#include "Utilization_Monitor.h" + +HostMonitorImpl::HostMonitorImpl (CORBA::ORB_ptr orb, Monitor_Thread *mt) + : monitor_thread_ (mt), + port_counter_ (HMOptions::instance ()->port_range_begin ()), + connector_ (monitor_thread_->get_reactor ()), + orb_ (CORBA::ORB::_duplicate (orb)) +{ + this->create_RM_Proxy (); +} + +HostMonitorImpl::~HostMonitorImpl (void) +{ + this->remove_RM_Proxy (); +} + +void +HostMonitorImpl::dump (void) +{ + //ACE_DEBUG ((LM_DEBUG, "inside dump method\n")); +} + + +::CORBA::Boolean +HostMonitorImpl::register_process (const char *process_id, + const char * hostname, + CORBA::Long port) +{ + //ACE_DEBUG ((LM_DEBUG, "Entering register process\n")); + Failure_Handler *handler = 0; + ACE_SOCK_Connector::PEER_ADDR serv_addr; + serv_addr.set (port, hostname); + ACE_Synch_Options options (ACE_Synch_Options::USE_TIMEOUT, + ACE_Time_Value (1)); + + if (connector_.connect (handler, serv_addr, options) < 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Failed to open an connector socket.\n"), 1); + } + + handler->set_host_monitor (this); + handler->watch_process (handler->get_handle (), + process_id, + hostname, + port); + process_map_.bind (process_id, handler); + + ACE_DEBUG ((LM_TRACE, + "HostMonitorImpl::register_process " + "process_id = %s, port = %d.\n", + process_id, + port)); + + return true; +} + +::CORBA::Boolean +HostMonitorImpl::unregister_process (const char *process_id) +{ + Failure_Handler *handler = 0; + + if (process_map_.find (process_id, handler) == 0) + { + ACE_DEBUG ((LM_DEBUG, + "HostMonitorImpl::unregister_process %s.\n", + process_id)); + + if ((handler->drop_process (handler->get_handle ()) == 0)) + { + if (remove_process (process_id) == 0) + { + return true; + } + } + else + { + ACE_DEBUG ((LM_DEBUG, + "HostMonitorImpl::unregister_process " + "Process %s can't be dropped!\n", + process_id)); + } + } + else + { + ACE_DEBUG ((LM_DEBUG, + "HostMonitorImpl::unregister_process " + "Invalid process_id = %s.\n", + process_id)); + } + + return true; +} + +::CORBA::Short +HostMonitorImpl::heartbeat_port (void) +{ + /* + ACE_DEBUG ((LM_TRACE, "HostMonitorImpl::heartbeat_port () - " + "sent out port number %d\n", port_counter_)); + */ + return port_counter_++; +} + +int HostMonitorImpl::drop_process (const std::string &process_id) +{ + Failure_Handler *handler = 0; + + if (process_map_.find (process_id, handler) == 0) + { + rm_proxy_->proc_failure (process_id); + return remove_process (process_id); + } + + return -1; +} + +RM_Proxy *HostMonitorImpl::create_RM_Proxy (void) +{ + if (rm_proxy_.get() == 0) + { + std::auto_ptr <Utilization_Monitor> util_mon ( + new Utilization_Monitor); + std::auto_ptr <RM_Proxy> rm_proxy (new RM_Proxy (orb_)); + + rm_proxy->set_Utilization_Monitor (util_mon.get ()); + util_mon->set_RM_Proxy (rm_proxy.get ()); + + rm_proxy->hertz (HMOptions::instance ()->RM_update_freq ()); + util_mon->hertz (HMOptions::instance ()->load_monitor_freq ()); + + util_mon->start (); + rm_proxy->start (); + + /// Trasnfer of ownership. + this->util_mon_ = util_mon; + this->rm_proxy_ = rm_proxy; + } + + return rm_proxy_.get (); +} + +void HostMonitorImpl::remove_RM_Proxy (void) +{ + if (process_map_.current_size() == 0) + { + rm_proxy_->stop (); + util_mon_->stop (); + rm_proxy_.reset (0); + util_mon_.reset (0); + } +} + +int HostMonitorImpl::remove_process (std::string const &process_id) +{ + if (process_map_.unbind (process_id) == 0) + { + return 0; + } + + return -1; +} + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h new file mode 100644 index 00000000000..a8b31f6bdc8 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/HostMonitorImpl.h @@ -0,0 +1,74 @@ +// -*- C++ -*- +// $Id$ + +#ifndef __HOSTMONITORIMPL_H +#define __HOSTMONITORIMPL_H + +#include <string> + +#include "ace/Map_Manager.h" +#include "ace/Event_Handler.h" +#include "ace/Thread_Mutex.h" +#include "ace/SOCK_Connector.h" + +#include "HostMonitorS.h" + +#include "Failure_Handler.h" +#include "Utilization_Monitor.h" +#include "RM_Proxy.h" + +class Monitor_Thread; + +class HostMonitor_Export HostMonitorImpl + : public virtual POA_HostMonitor +{ +public: + + typedef ACE_Map_Manager <std::string, + Failure_Handler *, + ACE_Thread_Mutex> + ProcessHandlerMap; + + HostMonitorImpl (CORBA::ORB_ptr, Monitor_Thread *); + + int + drop_process (const std::string &process_id); + + virtual + ~HostMonitorImpl (); + + ::CORBA::Boolean + register_process (const char *process_id, + const char * hostname, + CORBA::Long port); + + ::CORBA::Boolean + unregister_process (const char *process_id); + + virtual ::CORBA::Short + heartbeat_port (void); + + void + dump (void); + +protected: + RM_Proxy * + create_RM_Proxy (void); + + void + remove_RM_Proxy (void); + + int + remove_process (std::string const &process_id); + +private: + Monitor_Thread *monitor_thread_; + CORBA::Short port_counter_; + std::auto_ptr <RM_Proxy> rm_proxy_; + std::auto_ptr <Utilization_Monitor> util_mon_; + ProcessHandlerMap process_map_; + ACE_Connector <Failure_Handler, ACE_SOCK_Connector> connector_; + CORBA::ORB_var orb_; +}; + +#endif // __HOSTMONITORIMPL_H diff --git a/TAO/orbsvcs/orbsvcs/LWFT/IOR_Interceptor.cpp b/TAO/orbsvcs/orbsvcs/LWFT/IOR_Interceptor.cpp new file mode 100644 index 00000000000..caef2db61ca --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/IOR_Interceptor.cpp @@ -0,0 +1,66 @@ +// -*- C++ -*- +// $Id$ + +#include "IOR_Interceptor.h" +#include "ObjectReferenceFactory.h" +#include "tao/ORB_Constants.h" + +ACE_RCSID (Hello, + IOR_Interceptor, + "$Id$") + +IOR_Interceptor::IOR_Interceptor (void) +{ +} + +char * +IOR_Interceptor::name (void) +{ + return CORBA::string_dup ("IOR_Interceptor"); +} + +void +IOR_Interceptor::destroy (void) +{ +} + +void +IOR_Interceptor::establish_components ( + PortableInterceptor::IORInfo_ptr /* info */) +{ +} + +void +IOR_Interceptor::components_established ( + PortableInterceptor::IORInfo_ptr info) +{ + PortableInterceptor::ObjectReferenceFactory_var old_orf = + info->current_factory (); + + PortableInterceptor::ObjectReferenceFactory * tmp; + ACE_NEW_THROW_EX (tmp, + ObjectReferenceFactory (old_orf.in ()), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + ENOMEM), + CORBA::COMPLETED_NO)); + + PortableInterceptor::ObjectReferenceFactory_var orf = tmp; + + info->current_factory (orf.in ()); +} + +void +IOR_Interceptor::adapter_manager_state_changed ( + const char *, + PortableInterceptor::AdapterState) +{ +} + +void +IOR_Interceptor:: adapter_state_changed ( + const PortableInterceptor::ObjectReferenceTemplateSeq &, + PortableInterceptor::AdapterState) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/IOR_Interceptor.h b/TAO/orbsvcs/orbsvcs/LWFT/IOR_Interceptor.h new file mode 100644 index 00000000000..e902cc170a3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/IOR_Interceptor.h @@ -0,0 +1,65 @@ +// -*- C++ -*- +// $Id$ + +#ifndef IOR_INTERCEPTOR_H +#define IOR_INTERCEPTOR_H + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/IORInterceptor/IORInterceptor.h" +#include "tao/PortableInterceptorC.h" +#include "tao/LocalObject.h" + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class IOR_Interceptor + : public virtual PortableInterceptor::IORInterceptor_3_0, + public virtual TAO_Local_RefCounted_Object +{ +public: + + IOR_Interceptor (void); + + /** + * @name Methods Required by the IOR Interceptor Interface + * + * These are methods that must be implemented since they are pure + * virtual in the abstract base class. They are the canonical + * methods required for all IOR interceptors. + */ + //@{ + /// Return the name of this IORInterceptor. + virtual char * name (void); + + /// Cleanup resources acquired by this IORInterceptor. + virtual void destroy (void); + + /// Add the tagged components to the IOR. + virtual void establish_components ( + PortableInterceptor::IORInfo_ptr info); + + virtual void components_established ( + PortableInterceptor::IORInfo_ptr info); + + virtual void adapter_manager_state_changed ( + const char * id, + PortableInterceptor::AdapterState state); + + virtual void adapter_state_changed ( + const PortableInterceptor::ObjectReferenceTemplateSeq & templates, + PortableInterceptor::AdapterState state); + +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* IOR_INTERCEPTOR_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT.mpc b/TAO/orbsvcs/orbsvcs/LWFT/LWFT.mpc new file mode 100644 index 00000000000..025a0095742 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT.mpc @@ -0,0 +1,263 @@ +// -*- MPC -*- +// $Id$ + +project(*Common) : pi_server, interceptors, iorinterceptor, orbsvcs_output { + sharedname = LWFT_Common + idlflags += -Wb,export_macro=LWFT_Common_Export \ + -Wb,export_include=lwft_common_export.h + dynamicflags = LWFT_COMMON_BUILD_DLL + + IDL_Files { + LWFTDataStructures.idl + } + + Source_Files { + Barrier_Guard.cpp + LWFTDataStructuresC.cpp + LWFTDataStructuresS.cpp + Timer.cpp + } + + Header_Files { + lwft_common_export.h + } + + Template_Files { + } +} + +project(*Client) : pi_server, interceptors, naming, orbsvcs_output { + after += *ReplicationManager + libs += LWFT_Common LWFT_ReplicationManager + idlflags += -St \ + -Wb,export_macro=LWFT_Client_Export \ + -Wb,export_include=lwft_client_export.h + dynamicflags = LWFT_CLIENT_BUILD_DLL + sharedname = LWFT_Client + + IDL_Files { + ForwardingAgent.idl + } + + Source_Files { + Client_ORBInitializer.cpp + Client_Request_Interceptor.cpp + ForwardingAgent.cpp + ForwardingAgentC.cpp + ForwardingAgentS.cpp + LWFT_Client_Init.cpp + } + + Header_Files { + Client_ORBInitializer.h + Client_Request_Interceptor.h + ForwardingAgent.h + ForwardingAgentC.h + ForwardingAgentS.h + lwft_client_export.h + LWFT_Client_Init.h + } + + Inline_Files { + ForwardingAgentC.inl + ForwardingAgentS.inl + } + + Template_Files { + } +} + +project(*Server) : iorinterceptor, orbsvcs_output { + after += *Common + libs += LWFT_Common + sharedname = LWFT_Server + idlflags += -Wb,stub_export_macro=LWFT_Server_Export \ + -Wb,stub_export_include=lwft_server_export.h \ + -Wb,skel_export_macro=HostMonitor_Export \ + -Wb,skel_export_include=host_monitor_export.h + dynamicflags = LWFT_SERVER_BUILD_DLL + + IDL_Files { + HostMonitor.idl + } + + IDL_Files { + idlflags += -SS + ObjectReferenceFactory.idl + } + + Source_Files { + AppOptions.cpp + AppSideMonitor_Thread.cpp + AppSideMonitor_Handler.cpp + AppSideReg.cpp + HostMonitorC.cpp + IOR_Interceptor.cpp + LWFT_Server_Init.cpp + ObjectReferenceFactory.cpp + ObjectReferenceFactoryC.cpp + ServerORBInitializer.cpp + } + + Header_Files { + lwft_server_export.h + HostMonitorC.h + } + + Inline_Files { + HostMonitorC.inl + ObjectReferenceFactoryC.inl + } + + Template_Files { + } +} + +project(*StateSyncAgent) : portableserver, orbsvcs_output { // , lwft_dds , splicelib { + after += *Common + idlflags += -Wb,export_macro=SSA_Export \ + -Wb,export_include=ssa_export.h + idlflags -= -St -Sa + dynamicflags = SSA_BUILD_DLL + libs += LWFT_Common + sharedname = LWFT_StateSyncAgent + + IDL_Files { + StateSynchronizationAgent.idl + ReplicatedApplication.idl + } + + Source_Files { + CorbaStateUpdate.cpp + DDSFailure.cpp + ReplicatedApplicationC.cpp + ReplicatedApplicationS.cpp + StatefulObject.cpp + StateSyncAgentTask.cpp + StateSynchronizationAgentC.cpp + StateSynchronizationAgentS.cpp + StateSynchronizationAgent_i.cpp + } + + Header_Files { + DDSStateReaderListener_T.h + DDSStateUpdate_T.h + ssa_export.h + } + + Inline_Files { + ReplicatedApplicationC.inl + ReplicatedApplicationS.inl + StateSynchronizationAgentC.inl + StateSynchronizationAgentS.inl + } + + Template_Files { + DDSStateReaderListener_T.cpp + DDSStateUpdate_T.cpp + } +} + +project(*ReplicationManager) : portableserver, orbsvcs_output { + after += *Common *StateSyncAgent + libs += LWFT_Common \ + LWFT_StateSyncAgent + sharedname = LWFT_ReplicationManager + dynamicflags = RM_BUILD_DLL + idlflags += -Wb,export_macro=RM_Export \ + -Wb,export_include=rm_export.h + + IDL_Files { + ReplicationManager.idl + FaultNotification.idl + } + + Source_Files { + ReplicationManagerC.cpp + ReplicationManagerS.cpp + FaultNotificationC.cpp + FaultNotificationS.cpp + } + + Header_Files { + ReplicationManagerC.h + ReplicationManagerS.h + FaultNotificationC.cpp + FaultNotificationS.cpp + rm_export.h + } + + Inline_Files { + ReplicationManagerC.inl + ReplicationManagerS.inl + FaultNotificationC.inl + FaultNotificationS.inl + } +} + +project(*ReplicationManagerImpl) : portableserver, orbsvcs_output, lwft_server { + after += *Client + libs += LWFT_Client + dynamicflags = RM_IMPL_BUILD_DLL + sharedname = LWFT_ReplicationManagerImpl + + IDL_Files { + idlflags -= -Sa -St + AppInfo.idl + } + + Source_Files { + ReplicationManager.cpp + AppInfoC.cpp + } + + Header_Files { + ReplicationManager.h + rm_impl_export.h + } + + Inline_Files { + } + + Template_Files { + } +} + +project(*HostMonitor) : ace_mc, portableserver, naming, orbsvcs_output { + after += *ReplicationManager *Server + libs += LWFT_Common \ + LWFT_Server \ + LWFT_ReplicationManager + sharedname = LWFT_HostMonitor + dynamicflags = HOSTMONITOR_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Failure_Handler.cpp + HMOptions.cpp + HostMonitorImpl.cpp + HostMonitorS.cpp + Monitor_Manager.cpp + Monitor_Thread.cpp + RM_Proxy.cpp + Utilization_Monitor.cpp + } + + Header_Files { + CPULoadCalculator.h + host_monitor_export.h + HostMonitorS.h + Monitor_Manager.h + } + + Inline_Files { + HostMonitorS.inl + Monitor_Manager.inl + } + + Template_Files { + } +} + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFTDataStructures.idl b/TAO/orbsvcs/orbsvcs/LWFT/LWFTDataStructures.idl new file mode 100644 index 00000000000..100ba1fbf9c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFTDataStructures.idl @@ -0,0 +1,27 @@ +// -*- IDL -*- + +//============================================================================= +/** + * @file LWFTDataStructures.idl + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _LWFT_DATASTRUCTURES_IDL_ +#define _LWFT_DATASTRUCTURES_IDL_ + +typedef sequence<Object> ObjectList; + +struct Rank +{ + string object_id; + boolean now; + ObjectList ior_list; +}; + +typedef sequence<Rank> RankList; + +#endif /* _LWFT_DATASTRUCTURES_IDL_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Client.vcproj b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Client.vcproj new file mode 100644 index 00000000000..13e0745874a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Client.vcproj @@ -0,0 +1,523 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="LWFT_Client" + ProjectGUID="{58B1DF30-FECA-1BAD-9336-8A678E2A5C2C}" + RootNamespace="LWFT_Client" + Keyword="Win32Proj" + SignManifests="true" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_Client\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT),$(TAO_ROOT)\orbsvcs" + PreprocessorDefinitions="LWFT_CLIENT_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT),$(TAO_ROOT)\orbsvcs" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_CodecFactoryd.lib TAO_PId.lib TAO_PortableServerd.lib TAO_PI_Serverd.lib TAO_CosNamingd.lib LWFT_ReplicationManagerd.lib LWFT_Commond.lib" + OutputFile="$(OutDir)\LWFT_Clientd.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Clientd.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_Client\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT),$(TAO_ROOT)\orbsvcs" + PreprocessorDefinitions="LWFT_CLIENT_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT),$(TAO_ROOT)\orbsvcs" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_CodecFactory.lib TAO_PI.lib TAO_PortableServer.lib TAO_PI_Server.lib TAO_CosNaming.lib LWFT_ReplicationManager.lib LWFT_Common.lib" + OutputFile="$(OutDir)\LWFT_Client.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Client.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_Client\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT),$(TAO_ROOT)\orbsvcs" + PreprocessorDefinitions="LWFT_CLIENT_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT),$(TAO_ROOT)\orbsvcs" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_CodecFactoryd.lib TAO_PId.lib TAO_PortableServerd.lib TAO_PI_Serverd.lib TAO_CosNamingd.lib LWFT_ReplicationManagerd.lib LWFT_Commond.lib" + OutputFile="$(OutDir)\LWFT_Clientd.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Clientd.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_Client\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT),$(TAO_ROOT)\orbsvcs" + PreprocessorDefinitions="LWFT_CLIENT_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT),$(TAO_ROOT)\orbsvcs" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_CodecFactory.lib TAO_PI.lib TAO_PortableServer.lib TAO_PI_Server.lib TAO_CosNaming.lib LWFT_ReplicationManager.lib LWFT_Common.lib" + OutputFile="$(OutDir)\LWFT_Client.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Client.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;cxx;cc;c;C"> + <File + RelativePath="Client_ORBInitializer.cpp"> + </File> + <File + RelativePath="Client_Request_Interceptor.cpp"> + </File> + <File + RelativePath="ForwardingAgent.cpp"> + </File> + <File + RelativePath="ForwardingAgentC.cpp"> + </File> + <File + RelativePath="ForwardingAgentS.cpp"> + </File> + <File + RelativePath="LWFT_Client_Init.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hh"> + <File + RelativePath="Client_ORBInitializer.h"> + </File> + <File + RelativePath="Client_Request_Interceptor.h"> + </File> + <File + RelativePath="ForwardingAgent.h"> + </File> + <File + RelativePath="ForwardingAgentC.h"> + </File> + <File + RelativePath="ForwardingAgentS.h"> + </File> + <File + RelativePath="lwft_client_export.h"> + </File> + <File + RelativePath="LWFT_Client_Init.h"> + </File> + </Filter> + <Filter + Name="Build Files" + Filter="mpc;mpb;mwc"> + <File + RelativePath="LWFT.mpc"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Idl Files" + Filter="idl"> + <File + RelativePath="ForwardingAgent.idl"> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ForwardingAgent.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs -St -Wb,export_macro=LWFT_Client_Export -Wb,export_include=lwft_client_export.h "ForwardingAgent.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ForwardingAgentC.cpp;ForwardingAgentC.h;ForwardingAgentC.inl;ForwardingAgentS.cpp;ForwardingAgentS.h;ForwardingAgentS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ForwardingAgent.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs -St -Wb,export_macro=LWFT_Client_Export -Wb,export_include=lwft_client_export.h "ForwardingAgent.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ForwardingAgentC.cpp;ForwardingAgentC.h;ForwardingAgentC.inl;ForwardingAgentS.cpp;ForwardingAgentS.h;ForwardingAgentS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ForwardingAgent.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs -St -Wb,export_macro=LWFT_Client_Export -Wb,export_include=lwft_client_export.h "ForwardingAgent.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ForwardingAgentC.cpp;ForwardingAgentC.h;ForwardingAgentC.inl;ForwardingAgentS.cpp;ForwardingAgentS.h;ForwardingAgentS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ForwardingAgent.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs -St -Wb,export_macro=LWFT_Client_Export -Wb,export_include=lwft_client_export.h "ForwardingAgent.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ForwardingAgentC.cpp;ForwardingAgentC.h;ForwardingAgentC.inl;ForwardingAgentS.cpp;ForwardingAgentS.h;ForwardingAgentS.inl"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Inline Files" + Filter="i;ipp;inl"> + <File + RelativePath="ForwardingAgentC.inl"> + </File> + <File + RelativePath="ForwardingAgentS.inl"> + </File> + </Filter> + <Filter + Name="Documentation" + Filter=""> + <File + RelativePath="README"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.cpp b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.cpp new file mode 100644 index 00000000000..a364a00e458 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.cpp @@ -0,0 +1,89 @@ +// -*- C++ -*- +// $Id$ + +#include "tao/PortableServer/PortableServer.h" +#include "tao/PortableServer/Servant_Base.h" +#include "tao/ORBInitializer_Registry.h" + +#include "orbsvcs/orbsvcs/Naming/Naming_Client.h" + +#include "LWFT_Client_Init.h" +#include "ForwardingAgent.h" +#include "Client_ORBInitializer.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +LWFT_Client_Init::LWFT_Client_Init (void) + : agent_ (new ForwardingAgent_i ()) +{ +} + +LWFT_Client_Init::~LWFT_Client_Init (void) +{ +} + +CORBA::ORB_ptr +LWFT_Client_Init::init (int &argc, + char *argv[], + const ACE_TCHAR *orb_name) +{ + CORBA::ORB_var the_orb; + + try + { + // Create an ORB initializer and register it. + PortableInterceptor::ORBInitializer_var orb_initializer = + new Client_ORBInitializer (agent_); + + PortableInterceptor::register_orb_initializer (orb_initializer.in ()); + + // fa_thread_ and calling app both own ORB reference. + the_orb = CORBA::ORB_init (argc, argv, orb_name); + + //==================================================== + // Must do this so we can create the Forwarding Agent + // object reference. If the calling application also + // does it, the second set of steps is idempotent. + + CORBA::Object_var obj = + the_orb->resolve_initial_references ("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (obj.in ()); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + poa_manager->activate (); + + //==================================================== + + // Resolve the Naming Service and get the objref of the RM. + TAO_Naming_Client naming_client; + naming_client.init (the_orb); + CosNaming::NamingContext_var root_context = + naming_client.get_context (); + + CosNaming::Name rm_name; + rm_name.length (1UL); + rm_name[0UL].id = "ReplicationManager"; + + CORBA::Object_var tmp = root_context->resolve (rm_name); + + ReplicationManager_var rm = + ReplicationManager::_narrow (tmp.in ()); + + // Give ownership to the POA in this thread. + PortableServer::ServantBase_var owner_transfer (agent_); + + // Create the object reference and register it with the RM. + agent_->initialize (rm.in ()); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("LWFT_Client_Init::init : exception caught :"); + return CORBA::ORB::_nil ();; + } + + return the_orb._retn (); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.h b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.h new file mode 100644 index 00000000000..9b081c084a9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Client_Init.h @@ -0,0 +1,61 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file LWFT_Client_Init.h + * + * $Id$ + * + * Encapsulates LWFT client initialization steps. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef TAO_LWFT_CLIENT_INIT_H +#define TAO_LWFT_CLIENT_INIT_H + +#include /**/ "ace/pre.h" + +#include "lwft_client_export.h" + +class ForwardingAgent_i; + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Versioned_Namespace.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class LWFT_Client_Init + * + * @brief A class that encapsulates the special initialization + * requirements of LWFT clients. + * + */ +namespace CORBA +{ + class ORB; + typedef ORB *ORB_ptr; +} + +class LWFT_Client_Export LWFT_Client_Init +{ +public: + LWFT_Client_Init (void); + ~LWFT_Client_Init (void); + + CORBA::ORB_ptr init (int &argc, + ACE_TCHAR *argv[], + const ACE_TCHAR *orb_name = 0); + +private: + ForwardingAgent_i *agent_; +}; + +#include /**/ "ace/post.h" + +#endif /*TAO_LWFT_CLIENT_INIT_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Common.vcproj b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Common.vcproj new file mode 100644 index 00000000000..57bf13f0ae5 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Common.vcproj @@ -0,0 +1,511 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="LWFT_Common" + ProjectGUID="{F8B1EBB0-FECA-1BAD-9336-8A678E2A5C2C}" + RootNamespace="LWFT_Common" + Keyword="Win32Proj" + SignManifests="true" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_Common\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="LWFT_COMMON_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_CodecFactoryd.lib TAO_PId.lib TAO_PortableServerd.lib TAO_PI_Serverd.lib TAO_Valuetyped.lib TAO_ObjRefTemplated.lib TAO_IORInterceptord.lib" + OutputFile="$(OutDir)\LWFT_Commond.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Commond.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_Common\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="LWFT_COMMON_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_CodecFactory.lib TAO_PI.lib TAO_PortableServer.lib TAO_PI_Server.lib TAO_Valuetype.lib TAO_ObjRefTemplate.lib TAO_IORInterceptor.lib" + OutputFile="$(OutDir)\LWFT_Common.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Common.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_Common\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="LWFT_COMMON_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_CodecFactoryd.lib TAO_PId.lib TAO_PortableServerd.lib TAO_PI_Serverd.lib TAO_Valuetyped.lib TAO_ObjRefTemplated.lib TAO_IORInterceptord.lib" + OutputFile="$(OutDir)\LWFT_Commond.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Commond.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_Common\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="LWFT_COMMON_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_CodecFactory.lib TAO_PI.lib TAO_PortableServer.lib TAO_PI_Server.lib TAO_Valuetype.lib TAO_ObjRefTemplate.lib TAO_IORInterceptor.lib" + OutputFile="$(OutDir)\LWFT_Common.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Common.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;cxx;cc;c;C"> + <File + RelativePath="Barrier_Guard.cpp"> + </File> + <File + RelativePath="LWFTDataStructuresC.cpp"> + </File> + <File + RelativePath="LWFTDataStructuresS.cpp"> + </File> + <File + RelativePath="Timer.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hh"> + <File + RelativePath="Barrier_Guard.h"> + </File> + <File + RelativePath="lwft_common_export.h"> + </File> + <File + RelativePath="LWFTDataStructuresC.h"> + </File> + <File + RelativePath="LWFTDataStructuresS.h"> + </File> + <File + RelativePath="Timer.h"> + </File> + </Filter> + <Filter + Name="Build Files" + Filter="mpc;mpb;mwc"> + <File + RelativePath="LWFT.mpc"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Idl Files" + Filter="idl"> + <File + RelativePath="LWFTDataStructures.idl"> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on LWFTDataStructures.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=LWFT_Common_Export -Wb,export_include=lwft_common_export.h "LWFTDataStructures.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="LWFTDataStructuresC.cpp;LWFTDataStructuresC.h;LWFTDataStructuresC.inl;LWFTDataStructuresS.cpp;LWFTDataStructuresS.h;LWFTDataStructuresS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on LWFTDataStructures.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=LWFT_Common_Export -Wb,export_include=lwft_common_export.h "LWFTDataStructures.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="LWFTDataStructuresC.cpp;LWFTDataStructuresC.h;LWFTDataStructuresC.inl;LWFTDataStructuresS.cpp;LWFTDataStructuresS.h;LWFTDataStructuresS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on LWFTDataStructures.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=LWFT_Common_Export -Wb,export_include=lwft_common_export.h "LWFTDataStructures.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="LWFTDataStructuresC.cpp;LWFTDataStructuresC.h;LWFTDataStructuresC.inl;LWFTDataStructuresS.cpp;LWFTDataStructuresS.h;LWFTDataStructuresS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on LWFTDataStructures.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=LWFT_Common_Export -Wb,export_include=lwft_common_export.h "LWFTDataStructures.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="LWFTDataStructuresC.cpp;LWFTDataStructuresC.h;LWFTDataStructuresC.inl;LWFTDataStructuresS.cpp;LWFTDataStructuresS.h;LWFTDataStructuresS.inl"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Inline Files" + Filter="i;ipp;inl"> + <File + RelativePath="LWFTDataStructuresC.inl"> + </File> + <File + RelativePath="LWFTDataStructuresS.inl"> + </File> + </Filter> + <Filter + Name="Documentation" + Filter=""> + <File + RelativePath="README"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT_ReplicationManager.vcproj b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_ReplicationManager.vcproj new file mode 100644 index 00000000000..90e0f78f304 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_ReplicationManager.vcproj @@ -0,0 +1,651 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="LWFT_ReplicationManager" + ProjectGUID="{B18F9403-FECA-1BAD-9336-8A678E2A5C2C}" + RootNamespace="LWFT_ReplicationManager" + Keyword="Win32Proj" + SignManifests="true" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_ReplicationManager\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="RM_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_PortableServerd.lib LWFT_StateSyncAgentd.lib LWFT_Commond.lib" + OutputFile="$(OutDir)\LWFT_ReplicationManagerd.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_ReplicationManagerd.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_ReplicationManager\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="RM_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_PortableServer.lib LWFT_StateSyncAgent.lib LWFT_Common.lib" + OutputFile="$(OutDir)\LWFT_ReplicationManager.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_ReplicationManager.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_ReplicationManager\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="RM_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_PortableServerd.lib LWFT_StateSyncAgentd.lib LWFT_Commond.lib" + OutputFile="$(OutDir)\LWFT_ReplicationManagerd.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_ReplicationManagerd.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_ReplicationManager\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="RM_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_PortableServer.lib LWFT_StateSyncAgent.lib LWFT_Common.lib" + OutputFile="$(OutDir)\LWFT_ReplicationManager.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_ReplicationManager.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;cxx;cc;c;C"> + <File + RelativePath="FaultNotificationC.cpp"> + </File> + <File + RelativePath="FaultNotificationS.cpp"> + </File> + <File + RelativePath="ReplicationManagerC.cpp"> + </File> + <File + RelativePath="ReplicationManagerS.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hh"> + <File + RelativePath="FaultNotificationC.cpp"> + </File> + <File + RelativePath="FaultNotificationC.h"> + </File> + <File + RelativePath="FaultNotificationS.cpp"> + </File> + <File + RelativePath="FaultNotificationS.h"> + </File> + <File + RelativePath="ReplicationManagerC.h"> + </File> + <File + RelativePath="ReplicationManagerS.h"> + </File> + <File + RelativePath="rm_export.h"> + </File> + </Filter> + <Filter + Name="Build Files" + Filter="mpc;mpb;mwc"> + <File + RelativePath="LWFT.mpc"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Idl Files" + Filter="idl"> + <File + RelativePath="FaultNotification.idl"> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on FaultNotification.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -Wb,export_macro=RM_Export -Wb,export_include=rm_export.h "FaultNotification.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="FaultNotificationC.cpp;FaultNotificationC.h;FaultNotificationC.inl;FaultNotificationS.cpp;FaultNotificationS.h;FaultNotificationS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on FaultNotification.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -Wb,export_macro=RM_Export -Wb,export_include=rm_export.h "FaultNotification.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="FaultNotificationC.cpp;FaultNotificationC.h;FaultNotificationC.inl;FaultNotificationS.cpp;FaultNotificationS.h;FaultNotificationS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on FaultNotification.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -Wb,export_macro=RM_Export -Wb,export_include=rm_export.h "FaultNotification.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="FaultNotificationC.cpp;FaultNotificationC.h;FaultNotificationC.inl;FaultNotificationS.cpp;FaultNotificationS.h;FaultNotificationS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on FaultNotification.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -Wb,export_macro=RM_Export -Wb,export_include=rm_export.h "FaultNotification.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="FaultNotificationC.cpp;FaultNotificationC.h;FaultNotificationC.inl;FaultNotificationS.cpp;FaultNotificationS.h;FaultNotificationS.inl"/> + </FileConfiguration> + </File> + <File + RelativePath="ReplicationManager.idl"> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ReplicationManager.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -Wb,export_macro=RM_Export -Wb,export_include=rm_export.h "ReplicationManager.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ReplicationManagerC.cpp;ReplicationManagerC.h;ReplicationManagerC.inl;ReplicationManagerS.cpp;ReplicationManagerS.h;ReplicationManagerS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ReplicationManager.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -Wb,export_macro=RM_Export -Wb,export_include=rm_export.h "ReplicationManager.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ReplicationManagerC.cpp;ReplicationManagerC.h;ReplicationManagerC.inl;ReplicationManagerS.cpp;ReplicationManagerS.h;ReplicationManagerS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ReplicationManager.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -Wb,export_macro=RM_Export -Wb,export_include=rm_export.h "ReplicationManager.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ReplicationManagerC.cpp;ReplicationManagerC.h;ReplicationManagerC.inl;ReplicationManagerS.cpp;ReplicationManagerS.h;ReplicationManagerS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ReplicationManager.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Sa -St -Wb,export_macro=RM_Export -Wb,export_include=rm_export.h "ReplicationManager.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ReplicationManagerC.cpp;ReplicationManagerC.h;ReplicationManagerC.inl;ReplicationManagerS.cpp;ReplicationManagerS.h;ReplicationManagerS.inl"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Inline Files" + Filter="i;ipp;inl"> + <File + RelativePath="FaultNotificationC.inl"> + </File> + <File + RelativePath="FaultNotificationS.inl"> + </File> + <File + RelativePath="ReplicationManagerC.inl"> + </File> + <File + RelativePath="ReplicationManagerS.inl"> + </File> + </Filter> + <Filter + Name="Template Files" + Filter=""> + <File + RelativePath="DDSStateReaderListener_T.cpp"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + </File> + <File + RelativePath="DDSStateUpdate_T.cpp"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + </File> + <File + RelativePath="StateSynchronizationAgent_i_T.cpp"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Documentation" + Filter=""> + <File + RelativePath="README"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Server.vcproj b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Server.vcproj new file mode 100644 index 00000000000..494b0af7c6c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Server.vcproj @@ -0,0 +1,587 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="LWFT_Server" + ProjectGUID="{38A1550B-FECA-1BAD-9336-8A678E2A5C2C}" + RootNamespace="LWFT_Server" + Keyword="Win32Proj" + SignManifests="true" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_Server\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="LWFT_SERVER_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_PortableServerd.lib TAO_CodecFactoryd.lib TAO_PId.lib TAO_Valuetyped.lib TAO_ObjRefTemplated.lib TAO_IORInterceptord.lib LWFT_Commond.lib" + OutputFile="$(OutDir)\LWFT_Serverd.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Serverd.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_Server\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="LWFT_SERVER_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_PortableServer.lib TAO_CodecFactory.lib TAO_PI.lib TAO_Valuetype.lib TAO_ObjRefTemplate.lib TAO_IORInterceptor.lib LWFT_Common.lib" + OutputFile="$(OutDir)\LWFT_Server.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Server.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_Server\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="LWFT_SERVER_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_PortableServerd.lib TAO_CodecFactoryd.lib TAO_PId.lib TAO_Valuetyped.lib TAO_ObjRefTemplated.lib TAO_IORInterceptord.lib LWFT_Commond.lib" + OutputFile="$(OutDir)\LWFT_Serverd.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Serverd.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_Server\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="LWFT_SERVER_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_PortableServer.lib TAO_CodecFactory.lib TAO_PI.lib TAO_Valuetype.lib TAO_ObjRefTemplate.lib TAO_IORInterceptor.lib LWFT_Common.lib" + OutputFile="$(OutDir)\LWFT_Server.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_Server.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;cxx;cc;c;C"> + <File + RelativePath="AppOptions.cpp"> + </File> + <File + RelativePath="AppSideMonitor_Handler.cpp"> + </File> + <File + RelativePath="AppSideMonitor_Thread.cpp"> + </File> + <File + RelativePath="AppSideReg.cpp"> + </File> + <File + RelativePath="HostMonitorC.cpp"> + </File> + <File + RelativePath="IOR_Interceptor.cpp"> + </File> + <File + RelativePath="LWFT_Server_Init.cpp"> + </File> + <File + RelativePath="ObjectReferenceFactory.cpp"> + </File> + <File + RelativePath="ObjectReferenceFactoryC.cpp"> + </File> + <File + RelativePath="ServerORBInitializer.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hh"> + <File + RelativePath="AppOptions.h"> + </File> + <File + RelativePath="AppSideMonitor_Handler.h"> + </File> + <File + RelativePath="AppSideMonitor_Thread.h"> + </File> + <File + RelativePath="AppSideReg.h"> + </File> + <File + RelativePath="HostMonitorC.h"> + </File> + <File + RelativePath="IOR_Interceptor.h"> + </File> + <File + RelativePath="lwft_server_export.h"> + </File> + <File + RelativePath="LWFT_Server_Init.h"> + </File> + <File + RelativePath="ObjectReferenceFactoryC.h"> + </File> + <File + RelativePath="ServerORBInitializer.h"> + </File> + </Filter> + <Filter + Name="Build Files" + Filter="mpc;mpb;mwc"> + <File + RelativePath="LWFT.mpc"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Idl Files" + Filter="idl"> + <File + RelativePath="HostMonitor.idl"> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on HostMonitor.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,stub_export_macro=LWFT_Server_Export -Wb,stub_export_include=lwft_server_export.h -Wb,skel_export_macro=HostMonitor_Export -Wb,skel_export_include=host_monitor_export.h "HostMonitor.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="HostMonitorC.cpp;HostMonitorC.h;HostMonitorC.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on HostMonitor.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,stub_export_macro=LWFT_Server_Export -Wb,stub_export_include=lwft_server_export.h -Wb,skel_export_macro=HostMonitor_Export -Wb,skel_export_include=host_monitor_export.h "HostMonitor.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="HostMonitorC.cpp;HostMonitorC.h;HostMonitorC.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on HostMonitor.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,stub_export_macro=LWFT_Server_Export -Wb,stub_export_include=lwft_server_export.h -Wb,skel_export_macro=HostMonitor_Export -Wb,skel_export_include=host_monitor_export.h "HostMonitor.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="HostMonitorC.cpp;HostMonitorC.h;HostMonitorC.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on HostMonitor.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,stub_export_macro=LWFT_Server_Export -Wb,stub_export_include=lwft_server_export.h -Wb,skel_export_macro=HostMonitor_Export -Wb,skel_export_include=host_monitor_export.h "HostMonitor.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="HostMonitorC.cpp;HostMonitorC.h;HostMonitorC.inl"/> + </FileConfiguration> + </File> + <File + RelativePath="ObjectReferenceFactory.idl"> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ObjectReferenceFactory.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,stub_export_macro=LWFT_Server_Export -Wb,stub_export_include=lwft_server_export.h -Wb,skel_export_macro=HostMonitor_Export -Wb,skel_export_include=host_monitor_export.h -SS "ObjectReferenceFactory.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ObjectReferenceFactoryC.cpp;ObjectReferenceFactoryC.h;ObjectReferenceFactoryC.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ObjectReferenceFactory.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,stub_export_macro=LWFT_Server_Export -Wb,stub_export_include=lwft_server_export.h -Wb,skel_export_macro=HostMonitor_Export -Wb,skel_export_include=host_monitor_export.h -SS "ObjectReferenceFactory.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ObjectReferenceFactoryC.cpp;ObjectReferenceFactoryC.h;ObjectReferenceFactoryC.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ObjectReferenceFactory.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,stub_export_macro=LWFT_Server_Export -Wb,stub_export_include=lwft_server_export.h -Wb,skel_export_macro=HostMonitor_Export -Wb,skel_export_include=host_monitor_export.h -SS "ObjectReferenceFactory.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ObjectReferenceFactoryC.cpp;ObjectReferenceFactoryC.h;ObjectReferenceFactoryC.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ObjectReferenceFactory.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,stub_export_macro=LWFT_Server_Export -Wb,stub_export_include=lwft_server_export.h -Wb,skel_export_macro=HostMonitor_Export -Wb,skel_export_include=host_monitor_export.h -SS "ObjectReferenceFactory.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ObjectReferenceFactoryC.cpp;ObjectReferenceFactoryC.h;ObjectReferenceFactoryC.inl"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Inline Files" + Filter="i;ipp;inl"> + <File + RelativePath="HostMonitorC.inl"> + </File> + <File + RelativePath="ObjectReferenceFactoryC.inl"> + </File> + </Filter> + <Filter + Name="Documentation" + Filter=""> + <File + RelativePath="README"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.cpp b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.cpp new file mode 100644 index 00000000000..56b15af2563 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.cpp @@ -0,0 +1,60 @@ +// -*- C++ -*- +// $Id$ + +#include "tao/ORBInitializer_Registry.h" + +#include "tao/PortableServer/PortableServer.h" + +#include "tao/PI/PI.h" + +#include "LWFT_Server_Init.h" +#include "ServerORBInitializer.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +bool LWFT_Server_Init::initialized_ = false; + +LWFT_Server_Init::LWFT_Server_Init (void) +{ +} + +LWFT_Server_Init::~LWFT_Server_Init (void) +{ +} + +CORBA::ORB_ptr +LWFT_Server_Init::pre_init (int & /* argc */, char * /* argv */[]) +{ + CORBA::ORB_var the_orb; + + return the_orb._retn (); +} + +int +LWFT_Server_Init::Initializer (void) +{ + try + { + if (! LWFT_Server_Init::initialized_) + { + PortableInterceptor::ORBInitializer_ptr oi_ptr; + + ACE_NEW_RETURN (oi_ptr, + ServerORBInitializer, + -1); // No CORBA exceptions yet! + + PortableInterceptor::ORBInitializer_var orb_initializer = + oi_ptr; + PortableInterceptor::register_orb_initializer ( + orb_initializer.in ()); + + LWFT_Server_Init::initialized_ = true; + } + } + catch (CORBA::Exception& ex) + { + ACE_PRINT_EXCEPTION (ex, "LWFT_Server_Init::init: "); + } + + return 0; +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.h b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.h new file mode 100644 index 00000000000..3414508183d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_Server_Init.h @@ -0,0 +1,56 @@ +// -*- C++ -*- +// $Id$ + +//============================================================================= +/** + * @file LWFT_Client_Init.h + * + * $Id$ + * + * Encapsulates LWFT replicated application initialization steps. + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef TAO_LWFT_SERVER_INIT_H +#define TAO_LWFT_SERVER_INIT_H + +#include /**/ "ace/pre.h" + +#include "lwft_server_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Versioned_Namespace.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class LWFT_Server_Export LWFT_Server_Init +{ +public: + LWFT_Server_Init (void); + ~LWFT_Server_Init (void); + + CORBA::ORB_ptr pre_init (int &argc, char *argv[]); + + /// Used to force the registration of interceptors. + static int Initializer (void); + +private: + static bool initialized_; +}; + +static int +TAO_Requires_LWFT_Server_Initializer = LWFT_Server_Init::Initializer (); + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DECLARE (LWFT_Server_Init) +ACE_FACTORY_DECLARE (LWFT_Server, LWFT_Server_Init) + +#include /**/ "ace/post.h" + +#endif // TAO_LWFT_SERVER_INIT_H diff --git a/TAO/orbsvcs/orbsvcs/LWFT/LWFT_StateSyncAgent.vcproj b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_StateSyncAgent.vcproj new file mode 100644 index 00000000000..f10a2f7cf08 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/LWFT_StateSyncAgent.vcproj @@ -0,0 +1,681 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="LWFT_StateSyncAgent" + ProjectGUID="{17272710-FECA-1BAD-9336-8A678E2A5C2C}" + RootNamespace="LWFT_StateSyncAgent" + Keyword="Win32Proj" + SignManifests="true" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_StateSyncAgent\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="SSA_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_PortableServerd.lib LWFT_Commond.lib" + OutputFile="$(OutDir)\LWFT_StateSyncAgentd.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_StateSyncAgentd.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_StateSyncAgent\I386" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="SSA_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_PortableServer.lib LWFT_Common.lib" + OutputFile="$(OutDir)\LWFT_StateSyncAgent.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_StateSyncAgent.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Debug\LWFT_StateSyncAgent\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="SSA_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER=\"d\"" + MinimalRebuild="false" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACEd.lib TAOd.lib TAO_AnyTypeCoded.lib TAO_PortableServerd.lib LWFT_Commond.lib" + OutputFile="$(OutDir)\LWFT_StateSyncAgentd.dll" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="true" + SubSystem="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_StateSyncAgentd.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(ACE_ROOT)\lib" + IntermediateDirectory="Release\LWFT_StateSyncAgent\AMD64" + ConfigurationType="2" + CharacterSet="0" + + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + AdditionalOptions="" + AdditionalIncludeDirectories="" + TypeLibraryName="$(InputName).tlb" + HeaderFileName="$(InputName).h" + InterfaceIdentifierFileName="$(InputName)_i.c" + ProxyFileName="$(InputName)_p.c" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + PreprocessorDefinitions="SSA_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" + RuntimeLibrary="2" + RuntimeTypeInfo="true" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DisableSpecificWarnings="4355;4250;4290" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64" + Culture="1033" + AdditionalIncludeDirectories="$(ACE_ROOT),$(TAO_ROOT)" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/machine:AMD64" + AdditionalDependencies="ACE.lib TAO.lib TAO_AnyTypeCode.lib TAO_PortableServer.lib LWFT_Common.lib" + OutputFile="$(OutDir)\LWFT_StateSyncAgent.dll" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories=".;$(ACE_ROOT)\lib" + GenerateDebugInformation="false" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(ACE_ROOT)\lib\LWFT_StateSyncAgent.lib" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;cxx;cc;c;C"> + <File + RelativePath="CorbaStateUpdate.cpp"> + </File> + <File + RelativePath="DDSFailure.cpp"> + </File> + <File + RelativePath="ReplicatedApplicationC.cpp"> + </File> + <File + RelativePath="ReplicatedApplicationS.cpp"> + </File> + <File + RelativePath="StatefulObject.cpp"> + </File> + <File + RelativePath="StateSyncAgentTask.cpp"> + </File> + <File + RelativePath="StateSynchronizationAgent_i.cpp"> + </File> + <File + RelativePath="StateSynchronizationAgentC.cpp"> + </File> + <File + RelativePath="StateSynchronizationAgentS.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hh"> + <File + RelativePath="CorbaStateUpdate.h"> + </File> + <File + RelativePath="DDSFailure.h"> + </File> + <File + RelativePath="DDSStateReaderListener_T.h"> + </File> + <File + RelativePath="DDSStateUpdate_T.h"> + </File> + <File + RelativePath="ReplicatedApplicationC.h"> + </File> + <File + RelativePath="ReplicatedApplicationS.h"> + </File> + <File + RelativePath="ssa_export.h"> + </File> + <File + RelativePath="StatefulObject.h"> + </File> + <File + RelativePath="StateSyncAgentTask.h"> + </File> + <File + RelativePath="StateSynchronizationAgent_i.h"> + </File> + <File + RelativePath="StateSynchronizationAgentC.h"> + </File> + <File + RelativePath="StateSynchronizationAgentS.h"> + </File> + </Filter> + <Filter + Name="Build Files" + Filter="mpc;mpb;mwc"> + <File + RelativePath="LWFT.mpc"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Idl Files" + Filter="idl"> + <File + RelativePath="ReplicatedApplication.idl"> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ReplicatedApplication.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=SSA_Export -Wb,export_include=ssa_export.h "ReplicatedApplication.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ReplicatedApplicationC.cpp;ReplicatedApplicationC.h;ReplicatedApplicationC.inl;ReplicatedApplicationS.cpp;ReplicatedApplicationS.h;ReplicatedApplicationS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ReplicatedApplication.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=SSA_Export -Wb,export_include=ssa_export.h "ReplicatedApplication.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ReplicatedApplicationC.cpp;ReplicatedApplicationC.h;ReplicatedApplicationC.inl;ReplicatedApplicationS.cpp;ReplicatedApplicationS.h;ReplicatedApplicationS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ReplicatedApplication.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=SSA_Export -Wb,export_include=ssa_export.h "ReplicatedApplication.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ReplicatedApplicationC.cpp;ReplicatedApplicationC.h;ReplicatedApplicationC.inl;ReplicatedApplicationS.cpp;ReplicatedApplicationS.h;ReplicatedApplicationS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on ReplicatedApplication.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=SSA_Export -Wb,export_include=ssa_export.h "ReplicatedApplication.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="ReplicatedApplicationC.cpp;ReplicatedApplicationC.h;ReplicatedApplicationC.inl;ReplicatedApplicationS.cpp;ReplicatedApplicationS.h;ReplicatedApplicationS.inl"/> + </FileConfiguration> + </File> + <File + RelativePath="StateSynchronizationAgent.idl"> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on StateSynchronizationAgent.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=SSA_Export -Wb,export_include=ssa_export.h "StateSynchronizationAgent.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="StateSynchronizationAgentC.cpp;StateSynchronizationAgentC.h;StateSynchronizationAgentC.inl;StateSynchronizationAgentS.cpp;StateSynchronizationAgentS.h;StateSynchronizationAgentS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on StateSynchronizationAgent.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=SSA_Export -Wb,export_include=ssa_export.h "StateSynchronizationAgent.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="StateSynchronizationAgentC.cpp;StateSynchronizationAgentC.h;StateSynchronizationAgentC.inl;StateSynchronizationAgentS.cpp;StateSynchronizationAgentS.h;StateSynchronizationAgentS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on StateSynchronizationAgent.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=SSA_Export -Wb,export_include=ssa_export.h "StateSynchronizationAgent.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="StateSynchronizationAgentC.cpp;StateSynchronizationAgentC.h;StateSynchronizationAgentC.inl;StateSynchronizationAgentS.cpp;StateSynchronizationAgentS.h;StateSynchronizationAgentS.inl"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCustomBuildTool" + Description="Invoking $(ACE_ROOT)\bin\tao_idl on StateSynchronizationAgent.idl" + CommandLine="PATH=%PATH%;$(ACE_ROOT)\lib
$(ACE_ROOT)\bin\tao_idl -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -Wb,export_macro=SSA_Export -Wb,export_include=ssa_export.h "StateSynchronizationAgent.idl"" + AdditionalDependencies="$(ACE_ROOT)\bin\tao_idl.exe" + Outputs="StateSynchronizationAgentC.cpp;StateSynchronizationAgentC.h;StateSynchronizationAgentC.inl;StateSynchronizationAgentS.cpp;StateSynchronizationAgentS.h;StateSynchronizationAgentS.inl"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Inline Files" + Filter="i;ipp;inl"> + <File + RelativePath="ReplicatedApplicationC.inl"> + </File> + <File + RelativePath="ReplicatedApplicationS.inl"> + </File> + <File + RelativePath="StateSynchronizationAgentC.inl"> + </File> + <File + RelativePath="StateSynchronizationAgentS.inl"> + </File> + </Filter> + <Filter + Name="Template Files" + Filter=""> + <File + RelativePath="DDSStateReaderListener_T.cpp"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + </File> + <File + RelativePath="DDSStateUpdate_T.cpp"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + </File> + <File + RelativePath="StateSynchronizationAgent_i_T.cpp"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Documentation" + Filter=""> + <File + RelativePath="README"> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCustomBuildTool"/> + </FileConfiguration> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Manager.cpp b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Manager.cpp new file mode 100644 index 00000000000..5b825c35677 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Manager.cpp @@ -0,0 +1,69 @@ +// -*- C++ -*- +// +// $Id$ + +#include "Monitor_Manager.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if !defined (__ACE_INLINE__) +#include "Monitor_Manager.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + Monitor_Manager::Monitor_Manager (const Monitor_Manager &m) + : ptr_ (m.get ()) + { + this->ptr_->add_ref (); + } + + Monitor_Manager & + Monitor_Manager::operator= (Monitor_Base *p) + { + this->reset (p); + return *this; + } + + Monitor_Manager & + Monitor_Manager::operator= (const Monitor_Manager &m) + { + this->reset (m.get ()); + this->ptr_->add_ref (); + return *this; + } + + Monitor_Base * + Monitor_Manager::release (void) + { + Monitor_Base * val = this->ptr_; + this->ptr_ = 0; + return val; + } + + void + Monitor_Manager::free (void) + { + if (this->ptr_ != 0) + { + this->ptr_->remove_ref (); + } + } + + void + Monitor_Manager::reset (Monitor_Base *p) + { + this->free (); + this->ptr_ = p; + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif // ACE_HAS_MONITOR_FRAMEWORK == 1 + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Manager.h b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Manager.h new file mode 100644 index 00000000000..aa7c24c722d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Manager.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Monitor_Manager.h + * + * $Id$ + * + * @brief An auto ptr type class for Monitor_Base and its + * subclasses, which are all reference counted + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef MONITOR_MANAGER_H +#define MONITOR_MANAGER_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + class Monitor_Manager + { + public: + Monitor_Manager (void); + Monitor_Manager (Monitor_Base *); + Monitor_Manager (const Monitor_Manager &); + ~Monitor_Manager (void); + + Monitor_Manager & operator= (Monitor_Base *); + Monitor_Manager & operator= (const Monitor_Manager &); + Monitor_Base * operator-> (void) const; + + Monitor_Base * get (void) const; + Monitor_Base * release (void); + + private: + void free (void); + void reset (Monitor_Base *); + + private: + Monitor_Base * ptr_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "Monitor_Manager.inl" +#endif /* __ACE_INLINE__ */ + +#endif // ACE_HAS_MONITOR_FRAMEWORK == 1 + +#include /**/ "ace/post.h" + +#endif // MONITOR_MANAGER_H diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Manager.inl b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Manager.inl new file mode 100644 index 00000000000..7341bb4420a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Manager.inl @@ -0,0 +1,46 @@ +// -*- C++ -*- +// +// $Id$ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + ACE_INLINE + Monitor_Manager::Monitor_Manager (void) + : ptr_ (0) + { + } + + ACE_INLINE + Monitor_Manager::Monitor_Manager (Monitor_Base *p) + : ptr_ (p) + { + } + + ACE_INLINE + Monitor_Manager::~Monitor_Manager (void) + { + this->free (); + } + + ACE_INLINE + Monitor_Base * + Monitor_Manager::operator-> (void) const + { + return this->ptr_; + } + + ACE_INLINE + Monitor_Base * + Monitor_Manager::get (void) const + { + return this->ptr_; + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Thread.cpp b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Thread.cpp new file mode 100644 index 00000000000..81cb9178934 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Thread.cpp @@ -0,0 +1,53 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file C++ Implementation: Monitor_Thread + * + * @brief Defines implementation of Monitor_Thread. + * + */ + +#include "Monitor_Thread.h" + +#include "ace/TP_Reactor.h" +#include "tao/Exception.h" + +Monitor_Thread::Monitor_Thread (void) + : reactor_ (new ACE_TP_Reactor()) +{ +} + +int +Monitor_Thread::svc (void) +{ + try + { + if (reactor_.run_reactor_event_loop() == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Monitor_Thread: " + "run_reactor_event_loop failed\n"), + -1); + } + } + catch (CORBA::Exception & ex) + { + ACE_DEBUG ((LM_ERROR, + "Monitor_Thread::svc - caught %s", + ex._info ().c_str ())); + return -1; + } + + return 0; +} +/* +int Monitor_Thread::register_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) +{ + return reactor_.register_handler (event_handler, mask); +} +*/ +ACE_Reactor * Monitor_Thread::get_reactor (void) +{ + return &reactor_; +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Thread.h b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Thread.h new file mode 100644 index 00000000000..8caca98c50f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Monitor_Thread.h @@ -0,0 +1,38 @@ +// -*- C++ -*- +// $Id$ + +/** + * @file C++ Interface: Monitor_Thread + * + * @brief Declares interface for Monitor_Thread. + * + */ + +#ifndef __MONITOR_THREAD_H_ +#define __MONITOR_THREAD_H_ + +#include "ace/Reactor.h" +#include "ace/Task.h" + +#include "host_monitor_export.h" + +/** + * @class Monitor_Thread + * + * @brief Encapsulates Monitor_Thread + */ + +class HostMonitor_Export Monitor_Thread : public ACE_Task_Base +{ +public: + Monitor_Thread (void); + virtual int svc (void); + ACE_Reactor * get_reactor (void); + +private: + ACE_Reactor reactor_; +}; + + + +#endif /// __MONITOR_THREAD_H_ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.cpp b/TAO/orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.cpp new file mode 100644 index 00000000000..cacc0cdb409 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.cpp @@ -0,0 +1,58 @@ +// -*- C++ -*- +// $Id$ + +#include "ObjectReferenceFactory.h" +#include "tao/PortableServer/PortableServer.h" +#include "tao/Stub.h" +#include "tao/Profile.h" +#include "tao/debug.h" + +ACE_RCSID (Hello, + ObjectReferenceFactory, + "$Id$") + +ObjectReferenceFactory::ObjectReferenceFactory ( + PortableInterceptor::ObjectReferenceFactory * old_orf) + : old_orf_ (old_orf) +{ + CORBA::add_ref (old_orf); +} + +ObjectReferenceFactory::~ObjectReferenceFactory (void) +{ +} + +CORBA::Object_ptr +ObjectReferenceFactory::make_object ( + const char *repository_id, + const PortableInterceptor::ObjectId & id) +{ + ACE_ASSERT (repository_id != 0); + + CORBA::String_var s = PortableServer::ObjectId_to_string (id); + + CORBA::Object_var ref = this->old_orf_->make_object (repository_id, id); + + TAO_MProfile &mp = ref->_stubobj ()->base_profiles (); + + IOP::TaggedComponent mytag; + const char* tag = s.in (); + CORBA::ULong tag_id = 9654; + size_t tag_length = ACE_OS::strlen (tag); + mytag.tag = tag_id; + mytag.component_data.length (tag_length + 1); + + CORBA::Octet *buf = mytag.component_data.get_buffer (); + ACE_OS::memcpy (buf, tag, tag_length + 1); + buf[tag_length] = '\0'; + + const CORBA::ULong profile_count = mp.profile_count (); + + for (CORBA::ULong i = 0; i < profile_count; ++i) + { + TAO_Profile *profile = mp.get_profile (i); + profile->add_tagged_component (mytag); + } + + return ref._retn (); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.h b/TAO/orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.h new file mode 100644 index 00000000000..8c527b74507 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.h @@ -0,0 +1,66 @@ +// -*- C++ -*- +// $Id$ + +#ifndef TAO_OBJECT_REFERENCE_FACTORY_H +#define TAO_OBJECT_REFERENCE_FACTORY_H + +#include "ObjectReferenceFactoryC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class ObjectReferenceFactory + : public virtual OBV_lwft::ObjectReferenceFactory + , public virtual CORBA::DefaultValueRefCountBase +{ + public: + + /// Constructor + ObjectReferenceFactory ( + PortableInterceptor::ObjectReferenceFactory * old_orf); + + /** + * @name PortableInterceptor::ObjectReferenceFactory Methods + * + * Methods required by the + * PortableInterceptor::ObjectReferenceFactory interface. + */ + //@{ + virtual CORBA::Object_ptr make_object ( + const char *repository_id, + const PortableInterceptor::ObjectId & id); + //@} + +protected: + + /// Destructor + /** + * Protected destructor to enforce proper memory management via + * reference counting. + */ + ~ObjectReferenceFactory (void); + +private: + + /// The old ObjectReferenceFactory used to create object references. + /** + * This ObjectReferenceFactory will still be used when creating + * object references. However, it will be invoked through this + * ObjectReferenceFactory. + */ + PortableInterceptor::ObjectReferenceFactory_var old_orf_; + +}; + + +#if defined (_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* TAO_OBJECT_REFERENCE_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.idl b/TAO/orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.idl new file mode 100644 index 00000000000..356e208d3ad --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ObjectReferenceFactory.idl @@ -0,0 +1,17 @@ +// -*- IDL -*- +// $Id$ + +#ifndef OBJECT_REFERENCE_FACTORY_IDL +#define OBJECT_REFERENCE_FACTORY_IDL + +#include "tao/ObjRefTemplate/ObjectReferenceTemplate_include.pidl" + +module lwft +{ + + valuetype ObjectReferenceFactory + : PortableInterceptor::ObjectReferenceFactory {}; + +}; + +#endif /* OBJECT_REFERENCE_FACTORY_IDL */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/README b/TAO/orbsvcs/orbsvcs/LWFT/README new file mode 100644 index 00000000000..1e10ec3da02 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/README @@ -0,0 +1,18 @@ +The files in this directory build several libaries comprising +the TAO Lightweight Fault Tolerance (LWFT) service. Additional +files to build the ReplicationManager and HostMonitor +executables are found in $TAO_ROOT/orbsvcs/LWFT_Service. + +Some preprocessor flags must be set by hand to build and use +LWFT. TAO_HAS_EXTENDED_FT_INTERCEPTORS must be defined to 1, +either in $ACE_ROOT/ace/config.h or in $TAO_ROOT/tao/orbconf.h. +Adding the #define in orbconf.h has the advantage of causing +fewer libs to be rebuilt, but the disadvantage of the fact that +orbconf.h is in the source code repository, and so care must +be taken not to check in a modified version inadvertently. + +To make the CPU load monitor in the LWFT_HostMonitor library +functional, ACE monitor must be enabled, which is done by +#defining ACE_HAS_MONITOR_FRAMEWORK to 1 in +$ACE_ROOT/ace/config.h. If this is not done, the load will +always show as its default initialized value of 0.
\ No newline at end of file diff --git a/TAO/orbsvcs/orbsvcs/LWFT/RM_Proxy.cpp b/TAO/orbsvcs/orbsvcs/LWFT/RM_Proxy.cpp new file mode 100644 index 00000000000..3d4ec5fc8b1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/RM_Proxy.cpp @@ -0,0 +1,146 @@ +// -*- C++ -*- +// $Id$ + +#include <stdexcept> +#include <iostream> +#include <iterator> +#include <algorithm> + +#include "ace/Log_Msg.h" + +#include "orbsvcs/orbsvcs/Naming/Naming_Client.h" + +#include "RM_Proxy.h" +#include "HMOptions.h" + +RM_Proxy::RM_Proxy (CORBA::ORB_ptr orb) + : load_calc_ (0), + orb_ (CORBA::ORB::_duplicate (orb)) +{ + CORBA::Object_var obj = obtain_RM_ior (orb_.in ()); + + if (CORBA::is_nil (obj)) + { + ACE_DEBUG ((LM_ERROR, + "Nil Reference of ReplicationManager\n")); + throw std::runtime_error ("Nil Reference of ReplicationManager"); + } + + /// Downcast the object reference to a reference of type HostMonitor. + RM_var_ = ReplicationManager::_narrow (obj); + + if (CORBA::is_nil (RM_var_.in ())) + { + ACE_DEBUG ((LM_ERROR, + "Argument is not a ReplicationManager reference.\n")); + throw std::runtime_error ("Argument is not a ReplicationManager reference."); + } +} + +RM_Proxy::~RM_Proxy (void) +{ +} + +CORBA::Object_ptr +RM_Proxy::obtain_RM_ior (CORBA::ORB_ptr orb) +{ + CORBA::Object_ptr retval = CORBA::Object::_nil (); + + std::pair<char, std::string> ior_access = + HMOptions::instance ()->ior_access (); + + if (ior_access.first == 'i') /// file based IOR + { + retval = orb->string_to_object (ior_access.second.c_str()); + + if (CORBA::is_nil (retval)) + { + ACE_ERROR ((LM_ERROR, + "RM_Proxy: Null RM objref from OR file\n")); + } + else + { + // ACE_DEBUG ((LM_TRACE, + // "RM_Proxy: RM resolved from IOR file\n")); + } + } + else if (ior_access.first == 'n') /// Naming Service based IOR + { + TAO_Naming_Client naming_client; + naming_client.init (orb); + + CosNaming::Name name (1); + name.length (1); + name[0].id = CORBA::string_dup (ior_access.second.c_str()); + name[0].kind = CORBA::string_dup (""); + + retval = naming_client->resolve (name); + + if (CORBA::is_nil (retval)) + { + ACE_ERROR ((LM_ERROR, + "RM_Proxy: Null RM objref from Naming Service\n")); + } + else + { + //ACE_DEBUG ((LM_TRACE, + // "RM_Proxy: RM resolved from Naming Service\n")); + } + } + else + { + retval = + orb->string_to_object (HMOptions::instance ()->RM_ior ().c_str ()); + + if (CORBA::is_nil (retval)) + { + ACE_ERROR ((LM_ERROR, + "RM_Proxy: Null RM objref from IOR file\n")); + } + else + { + //ACE_DEBUG ((LM_TRACE, + // "RM_Proxy: RM resolved from IOR file\n")); + } + } + + return retval; +} + +void +RM_Proxy::set_Utilization_Monitor (Utilization_Monitor *load_calc) +{ + this->load_calc_ = load_calc; +} + +void +RM_Proxy::proc_failure (const std::string & process_id) +{ + try + { + if (CORBA::is_nil (RM_var_.in ())) + { + ACE_ERROR ((LM_ERROR, + "RM_Proxy::proc_failure - " + "RM reference is nil.\n")); + return; + } + + RM_var_->proc_failure (process_id.c_str()); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ( + "RM_Proxy::proc_failure: Exception caught:"); + } +} + +int +RM_Proxy::pulse (void) +{ + //ACE_DEBUG((LM_ERROR,"host_id=%s\n",HMOptions::instance()->host_id().c_str())); + //ACE_DEBUG((LM_ERROR,"load=%d\n", (int)load_calc_->percent_load())); + RM_var_->util_update (HMOptions::instance ()->host_id ().c_str (), + load_calc_->percent_load ()); + return 0; +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/RM_Proxy.h b/TAO/orbsvcs/orbsvcs/LWFT/RM_Proxy.h new file mode 100644 index 00000000000..365f09b1470 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/RM_Proxy.h @@ -0,0 +1,40 @@ +// -*- C++ -*- +// $Id$ + +#ifndef RM_PROXY_H +#define RM_PROXY_H + +#include <string> + +#include "Timer.h" + +#include "ReplicationManagerC.h" + +#include "Utilization_Monitor.h" + +class HostMonitor_Export RM_Proxy : protected Timer +{ +public: + using Timer::start; + using Timer::stop; + using Timer::hertz; + + RM_Proxy (CORBA::ORB_ptr); + virtual ~RM_Proxy (void); + void set_Utilization_Monitor (Utilization_Monitor *load_calc); + void proc_failure (const std::string &process_id); + + /// Helper function to be called back after a timeout + virtual int pulse (void); + +protected: + CORBA::Object_ptr obtain_RM_ior (CORBA::ORB_ptr orb); + +private: + Utilization_Monitor *load_calc_; + ReplicationManager_var RM_var_; + CORBA::ORB_var orb_; +}; + + +#endif /* RM_TIMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ReplicatedApplication.idl b/TAO/orbsvcs/orbsvcs/LWFT/ReplicatedApplication.idl new file mode 100644 index 00000000000..4b92456bd21 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ReplicatedApplication.idl @@ -0,0 +1,33 @@ +// -*- IDL -*- + +//============================================================================= +/** + * @file ReplicatedApplication.idl + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _REPLICATED_APPLICATION_IDL_ +#define _REPLICATED_APPLICATION_IDL_ + +interface StateSynchronizationAgent; + +interface ReplicatedApplication +{ + /// Setter method for the interal state. + /// @param state_value represents the internal state encapsulated + /// into an any value + void set_state (in any state_value); + + /// Getter method for the internal state. + /// remark: it's not clear if this is necessary + any get_state (); + + attribute StateSynchronizationAgent agent; + attribute string object_id; +}; + +#endif /* _REPLICATED_APPLICATION_IDL_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp new file mode 100644 index 00000000000..339c372ce96 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.cpp @@ -0,0 +1,2023 @@ +// -*- C++ -*- +// $Id$ + +#include "ReplicationManager.h" +#include "AppOptions.h" + +#include <string> +#include <set> + +#include "ace/OS_NS_unistd.h" + +#include "ForwardingAgentC.h" +#include "AppInfoC.h" + +template <class T> +void myswap (T & t1, T & t2) +{ + T temp (t1); + t1 = t2; + t2 = temp; +} + +UtilRank::UtilRank (void) + : util (0) +{ +} + +UtilRank::UtilRank (double u, const char * hid) + : util(u), + host_id (hid) +{ +} + +UtilRank::UtilRank (UtilRank const & ur) + : util(ur.util), + host_id (ur.host_id) +{ +} + +bool operator < (UtilRank const & u1, UtilRank const & u2) +{ + return u1.util >= u2.util; +} + +RANKED_IOR_LIST::RANKED_IOR_LIST (void) + : now (false) +{ +} + +APP_INFO::APP_INFO (void) + : load () +{ +} + +APP_INFO::APP_INFO (APP_INFO const & app_info) + : object_id (app_info.object_id.c_str ()), + load (app_info.load), + host_name (app_info.host_name.c_str ()), + process_id (app_info.process_id.c_str ()), + role (app_info.role), + ior (CORBA::Object::_duplicate (app_info.ior)) +{ +} + +APP_INFO::APP_INFO (const char *oid, + const char *hname, + const char *pid, + Role r) + : object_id (oid), + host_name (hname), + process_id (pid), + role (r) +{ +} + +APP_INFO::APP_INFO (const char *oid, + double l, + const char *hname, + const char *pid, + Role r, + CORBA::Object_ptr ref) + : object_id (oid), + load (l), + host_name (hname), + process_id (pid), + role (r), + ior (CORBA::Object::_duplicate (ref)) +{ +} + +void +APP_INFO::swap (APP_INFO & app_info) +{ + this->object_id.swap (app_info.object_id); + this->host_name.swap (app_info.host_name); + this->process_id.swap (app_info.process_id); + + myswap (this->ior, app_info.ior); + myswap (this->role, app_info.role); + myswap (this->load, app_info.load); +} + +APP_INFO & +APP_INFO::operator = (APP_INFO const & app_info) +{ + APP_INFO temp (app_info); + temp.swap (*this); + return *this; +} + +bool +operator == (APP_INFO const & lhs, APP_INFO const & rhs) +{ + return ((lhs.object_id == rhs.object_id) && + (lhs.host_name == rhs.host_name) && + (lhs.process_id == rhs.process_id) && + (lhs.role == rhs.role)); +} + +class Algorithm : public ACE_Task_Base +{ + ReplicationManager_i * rm_; +public: + Algorithm (ReplicationManager_i * rm); + virtual int svc (void); +}; + +Algorithm::Algorithm (ReplicationManager_i * rm) + : rm_ (rm) +{ +} + +int Algorithm::svc (void) +{ + while (true) + { + if (! rm_->replica_selection_algo ()) + { + break; + } + } + + return 0; +} + + +/* ******************************************************************* */ + +ReplicationManager_i::ReplicationManager_i (CORBA::ORB_ptr orb, + double hertz, + bool proactive, + bool static_mode, + AlgoMode mode) + : orb_ (CORBA::ORB::_duplicate (orb)), + proc_reg_ (orb), + algo_thread_(0), + standby_ (AppOptions::instance ()->role () > PRIMARY), + proactive_(proactive), + mode_(mode), + static_mode_ (static_mode), + update_available_(update_mutex_), + update_list_full_(update_mutex_), + ranklist_constraints_ (10), + subscription_counter_ (1), + notify_subscriptions_ (1) +{ + algo_thread_ = new Algorithm (this); + algo_thread_->activate (); + this->Timer::hertz (hertz); + this->Timer::start (); +} + +ReplicationManager_i::~ReplicationManager_i (void) +{ +} + +void +ReplicationManager_i::register_application ( + const char *object_id, + double load, + const char *host_id, + const char *process_id, + CORBA::Short role, + CORBA::Object_ptr server_reference) +{ + ACE_Guard <ACE_Thread_Mutex> guard (update_mutex_); + + ACE_Time_Value wait_time (5); + + while (update_list_.size() >= UPDATE_LIST_MAX_SIZE) + { + if(update_list_full_.wait (update_mutex_, &wait_time) == -1) // timeout + { + ACE_DEBUG ((LM_ERROR, + "RM: register_application CORBA upcall " + "waited too long. Skipping" + "register_application. %s:%s:%s:%d.\n", + host_id, + process_id, + object_id, + role)); + return; + } + } + + update_list_.insert_tail ( + MonitorUpdate::create_app_info_update (object_id, + load, + host_id, + process_id, + Role (role), + server_reference)); + update_available_.broadcast (); +} + +void +ReplicationManager_i::update_proc_host_map ( + const char *pid, + const char * hid, + STRING_TO_STRING_MAP & map) +{ + ACE_CString proc_id (pid); + ACE_CString host_id (hid); + + // If not present.l. + if (map.find (proc_id, host_id) != 0) + { + map.bind (proc_id, host_id); + } + else + { + ACE_DEBUG ((LM_ERROR, + "RM: Duplicate process_id=%s. Skipping it.\n", + pid)); + } +} + +void +ReplicationManager_i::update_appset_map ( + const char * key_str, + APP_INFO const & app_info, + OBJECTID_APPSET_MAP & map) +{ + APP_SET app_set; + ACE_CString key (key_str); + /* + ACE_DEBUG ((LM_TRACE, + "RM: update_appset_map - " + "add entry for %s, role = %d\n", + key_str, + app_info.role)); + */ + // If not present... + if (map.find (key, app_set) != 0) + { + app_set.insert_tail (app_info); + map.bind (key, app_set); + } + else + { + app_set.insert_tail (app_info); + map.rebind (key, app_set); + } +} + +void +ReplicationManager_i::update_map ( + const char * key_str, + const char * value_str, + STRING_TO_STRING_LIST_MAP & map) +{ + STRING_LIST slist; + ACE_CString key (key_str); + ACE_CString value (value_str); + + // If not present... + if (map.find (key, slist) != 0) + { + slist.insert_tail (value); + map.bind (key, slist); + } + else + { + slist.insert_tail (value); + map.rebind (key, slist); + } +} + +void +ReplicationManager_i::update_util_map ( + const char * key_str, + double value, + STRING_TO_DOUBLE_MAP & map) +{ + double v = 0; + + // If not present... + if (map.find (key_str, v) != 0) + { + // this means a new host monitor has joined and we can + map.bind (key_str, value); + + // if the host_monitor is on the same host + char hostname [100]; + gethostname (hostname, sizeof (hostname)); + + if (ACE_OS::strcmp (hostname, key_str) == 0) + { + int result = proc_reg_.register_process (); + + if (result != 0) + { + ACE_ERROR ((LM_ERROR, + "AppSideReg::activate () returned %d\n", + result)); + } + } + } + else + { + map.rebind (key_str, value); + } +} + +void +ReplicationManager_i::move_update_list ( + ACE_DLList<MonitorUpdate> & source, + ACE_DLList<MonitorUpdate> & dest) +{ + ACE_Guard <ACE_Thread_Mutex> guard(update_mutex_); + + while (update_list_.size() <= 0) + { + update_available_.wait (update_mutex_); + } + + while (MonitorUpdate * up = source.delete_head ()) + { + dest.insert_tail (up); + } + + update_list_full_.broadcast (); +} + +bool +ReplicationManager_i::process_updates ( + ACE_DLList<MonitorUpdate> & update_list) +{ + bool major_update = false; + bool only_util = true; + + while (MonitorUpdate * up = update_list.delete_head ()) + { + switch (up->type) + { + case MonitorUpdate::RUN_NOW: + //ACE_DEBUG ((LM_DEBUG,"RUN_NOW\n")); + major_update = true; + break; + case MonitorUpdate::HOST_UTIL_UPDATE: + //ACE_DEBUG ((LM_DEBUG,"HOST_UTIL_UPDATE\n")); + update_util_map (up->host_id.c_str (), + up->value, + this->hostid_util_map_); + + major_update = true; + break; + case MonitorUpdate::PROC_FAIL_UPDATE: + //ACE_DEBUG ((LM_DEBUG,"PROC_FAIL_UPDATE\n")); + process_proc_failure (up->process_id); + major_update = true; + only_util = false; + break; + case MonitorUpdate::APP_REG: + //ACE_DEBUG ((LM_DEBUG,"RUN_NOW\n")); + app_reg (up->app_info); + only_util = false; + break; + } + + delete up; + } + + if (!only_util) + { + //ACE_DEBUG ((LM_TRACE, "RM: state_changed () called.\n")); + this->send_state_synchronization_rank_list (); + agent_->state_changed (this->object_id ()); + standby_ = false; + } + + return major_update; +} + +void +ReplicationManager_i::process_proc_failure ( + ACE_CString const & process_id) +{ + ACE_DEBUG ((LM_TRACE, "RM: process_proc_failure (%s)\n", process_id.c_str ())); + + if (static_mode_) + { + //ACE_DEBUG ((LM_TRACE, "RM: process_proc_failure ()\n")); + + // Collect the app_info of all failed applications + // of a process. + std::vector <APP_INFO> failed; + + for (OBJECTID_APPSET_MAP::iterator it = + objectid_appset_map_.begin (); + it != objectid_appset_map_.end (); + ++it) + { + // For every object_id appset... + APP_SET & as = (*it).item (); + + // find the primary + for (APP_SET::iterator s_it = as.begin (); + s_it != as.end (); + ++s_it) + { + APP_INFO & ai = *s_it; + + // by looking at its role member + if (ai.process_id == process_id) + { + failed.push_back (ai); + } + } + } + + ACE_DEBUG ((LM_DEBUG, + "RM::process_proc_failure - found %d failed applications\n", + failed.size ())); + + CORBA::Object_var new_primary; + // For each failed application in this process... + for (std::vector <APP_INFO>::iterator fit = failed.begin (); + fit != failed.end (); + ++fit) + { + // ACE_DEBUG ((LM_TRACE, + // "RM::process_proc_failure dealing with failed app " + // "for %s\n", + // (*fit).object_id.c_str ())); + + // Remove entry from the appset. + APP_SET as; + + if (objectid_appset_map_.find ((*fit).object_id, + as) == 0) + { + //ACE_DEBUG ((LM_TRACE, + // "RM::process_proc_failure remove APP_INFO from APP_SET\n")); + + // Remove appinfo from the appset. + as.remove (*fit); + + objectid_appset_map_.rebind ((*fit).object_id, as); + } // end if find + + // We don't have to care about a rank_list + // that is already empty. + if (rank_list_.length () != 0) + { + // Find the right rank list. + size_t r = 0; + bool found_ranklist = false; + + for (; r < rank_list_.length (); ++r) + { + if ((*fit).object_id == rank_list_[r].object_id) + { + found_ranklist = true; + break; + } + } + + if (!found_ranklist) + { + /* + ACE_DEBUG ((LM_TRACE, + "RM::process_proc_failure - " + "found no rank_list for object_id=%s", + (*fit).object_id.c_str ())); + */ + break; + } + + //ACE_DEBUG ((LM_DEBUG, + // "RM::process_proc_failure - " + // "rank_list index found is %d.\n", r)); + + // Remove application from the rank_list. + if (rank_list_[r].ior_list.length () == 0) + { + //ACE_DEBUG ((LM_WARNING, "RM::process_proc_failure - " + // "empty ior list.\n")); + } + else + { + new_primary = + CORBA::Object::_duplicate (rank_list_[r].ior_list[0]); + + if (rank_list_[r].ior_list.length () == 1) + { + /* + ACE_DEBUG ((LM_DEBUG, + "RM::process_proc_failure - " + "remove complete ranklist.\n", + r)); + */ + // Remove complete rank_list entry. + for (size_t k = r; k < rank_list_.length () - 1; ++k) + { + // Move each following element one position + // forward. + rank_list_[k] = rank_list_[k+1]; + } + + rank_list_.length (rank_list_.length () - 1); + } + else + { + try + { + // Index of the element that should be removed from + // the ior list. + size_t rm_index = 0; + size_t len_i = rank_list_[r].ior_list.length (); + + if ((*fit).role != PRIMARY) + { + for (size_t j = 0; j < len_i; ++j) + { + if ((*fit).ior->_is_equivalent ( + rank_list_[r].ior_list[j].in ())) + { + rm_index = j; + break; + } + } + } + + ACE_DEBUG ((LM_TRACE, + "RM::process_proc_failure - " + "remove entry %d in ior list\n", + rm_index)); + + // Now remove the correct element from the list + for (size_t k = rm_index; k < len_i - 1; ++k) + { + // Move each following element one position + // forward. + rank_list_[r].ior_list[k] = + rank_list_[r].ior_list[k + 1]; + } + + // Adjust length of ior list. + rank_list_[r].ior_list.length ( + rank_list_[r].ior_list.length () - 1); + } // end try + catch (const CORBA::SystemException & ex) + { + // Just make sure to keep on going for the other + // entries here. + ACE_DEBUG ((LM_ERROR, + "RM::process_proc_failure - caught %d\n", + ex._info ().c_str ())); + } + } // end else + } // end else + + // Elevate new primary if necessary. + if ((*fit).role == PRIMARY) + { + /* + ACE_DEBUG ((LM_TRACE, + "RM::process_proc_failure - " + "select new primary in APP_SET (%d)\n", + as.size ())); + */ + for (APP_SET::iterator it = as.begin (); + it != as.end (); + ++it) + { + // Compare the object id to the first element in + // the rank list and mark it as primary. + + if (new_primary->_is_equivalent ((*it).ior.in ())) + { + (*it).role = PRIMARY; + + /* + ACE_DEBUG ((LM_DEBUG, + "RM::process_proc_failure - " + "found a new primary\n")); + */ + break; + } + } // end for + + objectid_appset_map_.rebind ((*fit).object_id, as); + } + } // end if rank_list is not empty + } // end for every failed application + + this->update_enhanced_ranklist (); + } + else // not in static_mode_ + { + ACE_CString host; + + // If present... + if (this->processid_host_map_.find (process_id, host) == 0) + { + ACE_DEBUG ((LM_TRACE, + "RM: process %s on host %s failed\n", + process_id.c_str (), + host.c_str ())); + + STRING_LIST primaries; + if (processid_primary_map_.find (process_id, primaries) == 0) + { + FLARE::ApplicationList ids; + CORBA::ULong index = 0; + ids.length (primaries.size ()); + for (STRING_LIST::iterator it = primaries.begin (); + it != primaries.end (); + ++it) + { + ids[index++] = (*it).c_str (); + } + // for now just take the first entry and send it + send_failure_notice (host.c_str (), + ids); + } + + replace_primary_tags (process_id, host); + replace_backup_tags (process_id, host); + this->processid_host_map_.unbind (process_id); + + STRING_LIST proc_list; + + if (this->hostid_process_map_.find (host,proc_list) == 0) // if present + { + proc_list.remove (process_id); + this->hostid_process_map_.rebind (host, proc_list); + } + else + { + ACE_DEBUG ((LM_ERROR, + "RM: Can't find host=%s in hostid_process_map. " + "Data structure invariant broken.\n", + host.c_str())); + } + } + else + { + ACE_DEBUG ((LM_ERROR, + "RM: Can't find process_id=%s in proc_host_map." + " Data structure invariant broken.\n", + process_id.c_str ())); + } + } +} + +void +ReplicationManager_i::replace_primary_tags ( + ACE_CString const & pid, + ACE_CString const & host) +{ + STRING_LIST tag_list; + + if (this->processid_primary_map_.find(pid, tag_list) == 0) + { + for (STRING_LIST::iterator tl_iter = tag_list.begin (); + tl_iter != tag_list.end (); + ++tl_iter) + { + remove_from_appset (host, pid, *tl_iter, PRIMARY); + elevate_backup_to_primary (*tl_iter); + } + + processid_primary_map_.unbind (pid); + } + // No worries for now if there are no primaries in the process. +} + +void +ReplicationManager_i::remove_from_appset ( + ACE_CString const & host, + ACE_CString const & pid, + ACE_CString const & tag, + Role role) +{ + APP_SET app_set; + + ACE_Guard <ACE_Recursive_Thread_Mutex> guard ( + this->appset_lock_); + + if (this->objectid_appset_map_.find (tag, app_set) == 0) + { + APP_INFO app_info (tag.c_str (), + host.c_str (), + pid.c_str(), + role); + + app_set.remove (app_info); + + this->objectid_appset_map_.rebind(tag,app_set); + + ACE_DEBUG ((LM_DEBUG, + "RM: Removed application %s:%s:%s:%d.\n", + host.c_str (), + pid.c_str (), + tag.c_str (), + role)); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "RM: Can't find appset for tag=%s.\n" + "Data structure invariant broken.", + tag.c_str ())); + } +} + +void +ReplicationManager_i::elevate_backup_to_primary ( + ACE_CString const & tag) +{ + RANKED_IOR_LIST ranked_ior_list; + ACE_CString failover_host; + + if (this->objectid_rankedior_map_.find (tag,ranked_ior_list) == 0) + { + failover_host = ranked_ior_list.host_list.front(); + ACE_DEBUG ((LM_DEBUG, + "RM: Failover host = %s.\n", + failover_host.c_str ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "RM: Can't find failover host for tag=%s.\n", + tag.c_str ())); + } + + APP_SET app_set; + + ACE_Guard <ACE_Recursive_Thread_Mutex> guard (this->appset_lock_); + + if (this->objectid_appset_map_.find (tag, app_set) == 0) + { + for (APP_SET::iterator as_iter = app_set.begin (); + as_iter != app_set.end (); + ++as_iter) + { + if ((*as_iter).host_name == failover_host.c_str ()) + { + STRING_LIST backup_tag_list; + + if (this->processid_backup_map_.find ( + (*as_iter).process_id, + backup_tag_list) + == 0) + { + backup_tag_list.remove(tag); + + this->processid_backup_map_.rebind ( + (*as_iter).process_id, + backup_tag_list); + + STRING_LIST primary_tag_list; + + if (this->processid_primary_map_.find ( + (*as_iter).process_id, + primary_tag_list) + == 0) + { + primary_tag_list.insert_tail (tag); + this->processid_primary_map_.rebind ( + (*as_iter).process_id, + primary_tag_list); + } + else + { + primary_tag_list.insert_tail (tag); + this->processid_primary_map_.bind ( + (*as_iter).process_id, + primary_tag_list); + } + } + else + { + ACE_DEBUG ((LM_DEBUG, + "RM: Can't find backups for " + "tag=%s in process=%s.\n" + "Data structure invariant broken\n", + tag.c_str (), + (*as_iter).process_id.c_str ())); + } + + (*as_iter).role = PRIMARY; + this->objectid_appset_map_.rebind (tag, app_set); + break; + } + } + } + else + { + ACE_DEBUG ((LM_DEBUG, + "RM: No process found hosting tag=%s.\n", + tag.c_str ())); + } +} + +void +ReplicationManager_i::replace_backup_tags ( + ACE_CString const & pid, + ACE_CString const & host) +{ + STRING_LIST backup_tag_list; + + if (this->processid_backup_map_.find (pid, backup_tag_list) == 0) + { + for (STRING_LIST::iterator bt_iter = backup_tag_list.begin (); + bt_iter != backup_tag_list.end (); + ++bt_iter) + { + remove_from_appset (host, pid, *bt_iter, BACKUP); + } + + this->processid_backup_map_.unbind(pid); + } +} + +void +ReplicationManager_i::load_based_selection_algo (void) +{ + for (STRING_TO_STRING_LIST_MAP::iterator hp_iter = + hostid_process_map_.begin (); + hp_iter != hostid_process_map_.end (); + ++hp_iter) + { + STRING_TO_DOUBLE_MAP processor_level_host_util_map; + + copy_map (this->hostid_util_map_, + processor_level_host_util_map); + + STRING_LIST & process_list = (*hp_iter).item (); + + for (STRING_LIST::iterator pl_iter = + process_list.begin (); + pl_iter != process_list.end (); + ++pl_iter) + { + STRING_TO_DOUBLE_MAP process_level_host_util_map; + + copy_map (this->hostid_util_map_, + process_level_host_util_map); + + STRING_TO_DOUBLE_MAP & host_util_map = + (this->mode_ == PROCESS_LEVEL) + ? process_level_host_util_map + : processor_level_host_util_map; + + STRING_LIST primary_object_list; + + if (processid_primary_map_.find (*pl_iter, + primary_object_list) == 0) // If present + { + for (STRING_LIST::iterator po_iter = + primary_object_list.begin (); + po_iter != primary_object_list.end (); + ++po_iter) + { + STRING_LIST host_list = + non_primary_host_list (*po_iter); + + // If the object has backups... + if (host_list.size () >= 1) + { + std::priority_queue<UtilRank> util_ranked_queue = + util_sorted_host_list(*po_iter, host_list, host_util_map); + + // this check is necessary to make sure + // there is utilization information for + // this host available. When a + // ReplicationManager starts up for + // example the host_monitor on that host + // is not yet running. + if (util_ranked_queue.size () > 0) + { + UtilRank ur (util_ranked_queue.top ()); + + host_util_map.rebind (ur.host_id.c_str (), + ur.util); + + update_ior_map (*po_iter, + util_ranked_queue); + } + } //end if (host_list.size () >= 1) + } // end for primary_object_list + } // end if processid_primary_map_.find () + } // end for process_list + } // end for hostid_process_map +} + +void +ReplicationManager_i::static_selection_algo (void) +{ + // enter entries from objectid_appset_map_ into + // objectid_rankedior_map_ according to the sorted list given by an + // external source. + + ACE_DEBUG ((LM_INFO, "RM: static ranklist order(%d):\n", + objectid_appset_map_.current_size ())); + + APP_SET tmp_apps; + for (OBJECTID_APPSET_MAP::iterator appset_it = objectid_appset_map_.begin (); + appset_it != objectid_appset_map_.begin (); + ++appset_it) + { + ACE_DEBUG ((LM_INFO, "[\toid %s:", appset_it->key ().c_str ())); + + RANKED_IOR_LIST iorlist; + iorlist.now = false; + + tmp_apps = appset_it->item (); + + RANKLIST_CONSTRAINT constr; + // add all entries mentioned in the constraints in sorted order + if (ranklist_constraints_.find (appset_it->key (), + constr) == 0) + { + for (RANKLIST_CONSTRAINT::iterator const_it = constr.begin (); + const_it != constr.end (); + ++const_it) + { + // this is inefficient, but we'll go through the set and find + // the appropriate entry + for (APP_SET::iterator as_it = tmp_apps.begin (); + as_it != tmp_apps.end (); + ++as_it) + { + // if we found the right guy + if (const_it->compare ((*as_it).host_name) == 0) + { + if ((*as_it).role != PRIMARY) + { + ACE_DEBUG ((LM_INFO, "[\n\t\t%s", (*as_it).host_name.c_str ())); + + // add to ranklist + iorlist.host_list.push_back ((*as_it).host_name); + iorlist.ior_list.push_back (CORBA::Object::_duplicate ((*as_it).ior.in ())); + } + + // remove from set + tmp_apps.remove (*as_it); + + break; + } + } + } + } // end if find in ranklist_constraints_ + + // add remaing application entries + for (APP_SET::iterator app_it = tmp_apps.begin (); + app_it != tmp_apps.end (); + ++app_it) + { + if ((*app_it).role != PRIMARY) + { + ACE_DEBUG ((LM_INFO, "[\n\t\t%s", (*app_it).host_name.c_str ())); + + iorlist.host_list.push_back ((*app_it).host_name); + iorlist.ior_list.push_back (CORBA::Object::_duplicate ((*app_it).ior.in ())); + } + } // end for tmp_apps + + objectid_rankedior_map_.bind (appset_it->key (), + iorlist); + + ACE_DEBUG ((LM_INFO, "\n")); + } // end for objectid_appset_map_ +} + +bool +ReplicationManager_i::replica_selection_algo (void) +{ + ACE_DLList <MonitorUpdate> update_list; + move_update_list(this->update_list_, update_list); + + if (!static_mode_) + { + if (process_updates (update_list)) + { + objectid_rankedior_map_.close (); + objectid_rankedior_map_.open (); + +#ifdef ORIGINAL_SELECTION_ALGORITHM + this->load_based_selection_algo (); +#else + this->static_selection_algo (); +#endif + this->build_rank_list (); + this->update_enhanced_ranklist (); + } // end if process_updates + } // end if static_mode + + if (!standby_) + { + send_rank_list (); + send_state_synchronization_rank_list (); + } + + return true; +} + +void +ReplicationManager_i::print_queue ( + std::priority_queue<UtilRank> queue) +{ + while (!queue.empty ()) + { + UtilRank ur (queue.top ()); + queue.pop (); + ACE_DEBUG ((LM_DEBUG, + "%s:%f, ", + ur.host_id.c_str (), + ur.util)); + } + + ACE_DEBUG((LM_DEBUG,"\n")); +} + +void +ReplicationManager_i::copy_map ( + STRING_TO_DOUBLE_MAP const & source, + STRING_TO_DOUBLE_MAP & dest) +{ + dest.close (); + dest.open (); + + for (STRING_TO_DOUBLE_MAP::const_iterator iter (source.begin ()); + iter != source.end (); + ++iter) + { + dest.bind ((*iter).key().c_str (), (*iter).item ()); + } +} + +ReplicationManager_i::STRING_LIST +ReplicationManager_i::non_primary_host_list ( + ACE_CString const & primary_object_id) +{ + APP_SET app_set; + STRING_LIST host_list; + + ACE_Guard <ACE_Recursive_Thread_Mutex> guard ( + this->appset_lock_); + + if (objectid_appset_map_.find (primary_object_id, app_set) == 0) + { + for (APP_SET::iterator as_iter = app_set.begin (); + as_iter != app_set.end (); + ++as_iter) + { + if ((*as_iter).role != PRIMARY) + { + host_list.insert_tail ((*as_iter).host_name); + } + } + } + else + { + ACE_DEBUG ((LM_DEBUG, + "RM: No processes for tag = %s.\n", + primary_object_id.c_str ())); + } + + return host_list; +} + + +void +ReplicationManager_i::app_reg (APP_INFO & app) +{ + const char * object_id = app.object_id.c_str (); + double load = app.load; + const char * host_name = app.host_name.c_str (); + const char * process_id = app.process_id.c_str (); + Role role = app.role; + + // add the received information to a map that knows which object ids + // are in a process + + if (!static_mode_) + { + update_map (host_name, process_id, + this->hostid_process_map_); + + update_proc_host_map (process_id, + host_name, + this->processid_host_map_); + + update_util_map (object_id, + load, + this->objectid_load_map_); + + ACE_Guard <ACE_Recursive_Thread_Mutex> guard ( + this->appset_lock_); + + update_appset_map (object_id, + app, + this->objectid_appset_map_); + + switch (role) + { + case PRIMARY: + update_map (process_id, + object_id, + processid_primary_map_); + break; + case BACKUP: + update_map (process_id, + object_id, + processid_backup_map_); + + static_ranklist_update (object_id, + app.ior, + role); + + break; + default: + ACE_ERROR ((LM_ERROR, + "RM: in app_reg () - Unknown Role!!\n")); + } + + ACE_DEBUG ((LM_TRACE, + "RM: Registered successfully %s:%s:%s:%d " + "with Replication manager.\n", + host_name, + process_id, + object_id, + role)); + } + else // If in static_mode_ + { + ACE_Guard <ACE_Recursive_Thread_Mutex> guard ( + this->appset_lock_); + + update_appset_map (object_id, + app, + this->objectid_appset_map_); + + switch (role) + { + case PRIMARY: + break; + case BACKUP: + // Update only the rank list - ignore the other maps. + static_ranklist_update (object_id, + app.ior, + role); + /* + ACE_DEBUG ((LM_DEBUG, + "RM: Registered %s:%s:%s:%d with " + "Replication manager in static mode.\n", + host_name, + process_id, + object_id, + role));*/ + break; + default: + ACE_ERROR ((LM_ERROR, + "RM: in app_reg () - Unknown Role!!\n")); + } + + this->update_enhanced_ranklist (); + } +} + +void +ReplicationManager_i::static_ranklist_update ( + const char * object_id, + CORBA::Object_ptr ior, + Role role) +{ + ACE_Write_Guard <ACE_RW_Thread_Mutex> guard ( + rank_list_mutex_); + + bool found = false; + size_t i = 0; + + for (i = 0; i < rank_list_.length(); ++i) + { + if (ACE_OS::strcmp (rank_list_[i].object_id, object_id) == 0) + { + found = true; + break; + } + } + + if (found && (role == BACKUP)) + { + size_t ior_list_length = rank_list_[i].ior_list.length (); + + rank_list_[i].ior_list.length (ior_list_length + 1); + + rank_list_[i].ior_list[ior_list_length] = + CORBA::Object::_duplicate (ior); + } + else + { + size_t rl_length = rank_list_.length (); + + rank_list_.length (rl_length + 1); + + rank_list_[rl_length].object_id = + CORBA::string_dup (object_id); + + rank_list_[rl_length].now = false; + + size_t ior_list_length = + rank_list_[rl_length].ior_list.length (); + + rank_list_[rl_length].ior_list.length (ior_list_length + 1); + + rank_list_[rl_length].ior_list[ior_list_length] = + CORBA::Object::_duplicate (ior); + } +} + +std::priority_queue<UtilRank> +ReplicationManager_i::util_sorted_host_list ( + ACE_CString const & oid, + STRING_LIST const & host_list, + STRING_TO_DOUBLE_MAP const & hu_map) +{ + std::priority_queue <UtilRank> rank_list; + double object_load; + + if (objectid_load_map_.find (oid, object_load) == 0) + { + for (STRING_LIST::const_iterator hl_iter = + host_list.begin (); + hl_iter != host_list.end (); + ++hl_iter) + { + double host_utilization; + + // If present... + if (hu_map.find (*hl_iter, host_utilization) == 0) + { + double effective_load = + object_load + host_utilization; + + rank_list.push (UtilRank (effective_load, + (*hl_iter).c_str ())); + } + else + { + ACE_DEBUG ((LM_WARNING, + "RM: Can't find utilization " + "of host_id=%s\n", + (*hl_iter).c_str ())); + + /* + ACE_DEBUG ((LM_ERROR, + "Size of utilmap=%d\n", + hu_map.current_size ())); + */ + break; + } + } + } + else + { + ACE_DEBUG ((LM_ERROR, + "RM: Can't find load of object_id=%s\n", + oid.c_str ())); + } + + return rank_list; +} + + +void +ReplicationManager_i::build_rank_list (void) +{ + // this is only necessary for several hosts. + ACE_Write_Guard <ACE_RW_Thread_Mutex> guard ( + rank_list_mutex_); + + this->rank_list_.length (0); + + for (OBJECTID_RANKED_IOR_MAP::iterator or_iter = + this->objectid_rankedior_map_.begin(); + or_iter != this->objectid_rankedior_map_.end(); + ++or_iter) + { + CORBA::ULong rank_list_length = + this->rank_list_.length (); + + rank_list_.length (rank_list_length + 1); + + rank_list_[rank_list_length].object_id = + CORBA::string_dup((*or_iter).key().c_str()); + + RANKED_IOR_LIST & ranked_ior_list = + (*or_iter).item (); + + rank_list_[rank_list_length].now = + ranked_ior_list.now; + + for (std::list<CORBA::Object_var>::iterator ior_iter = + ranked_ior_list.ior_list.begin (); + ior_iter != ranked_ior_list.ior_list.end (); + ++ior_iter) + { + CORBA::ULong ior_list_length = + rank_list_[rank_list_length].ior_list.length (); + + rank_list_[rank_list_length].ior_list.length ( + ior_list_length + 1); + + rank_list_[rank_list_length].ior_list[ior_list_length] = + CORBA::Object::_duplicate (*ior_iter); + } + } +} + +void +ReplicationManager_i::update_enhanced_ranklist (void) +{ + ACE_Guard <ACE_Thread_Mutex> enhanced_list_guard ( + enhanced_rank_list_agent_list_combined_mutex_); + + ACE_Read_Guard <ACE_RW_Thread_Mutex> guard ( + rank_list_mutex_); + + // get all existing primaries from the appset map + // for some reason this creates a trace output + // "ACE_Hash_Map_Manager_Ex" on stdout. + OBJECTID_APPINFO_MAP primaries; + + for (OBJECTID_APPSET_MAP::iterator it = + objectid_appset_map_.begin (); + it != objectid_appset_map_.end (); + ++it) + { + // for every object_id appset + APP_SET & as = (*it).item (); + + // find the primary + for (APP_SET::iterator s_it = as.begin (); + s_it != as.end (); + ++s_it) + { + APP_INFO & ai = *s_it; + + // by looking at its role member + if (ai.role == PRIMARY) + { + primaries.bind ((*it).key (), ai); + + // if the primary has been found we can abort this loop + break; + } + } + } + + // to determine the size of the enhanced rank_list we have to + // account for the union of all existing primaries (including those + // without backup entries in the rank_list) and for all the + // rank_list entries that have no primary running yet. To achieve + // this we create to sets with all the application names: One for + // the primaries and one for the rank_list and do a union on them. + + // create a set of strings for the primary names + std::set <std::string> primary_names; + for (OBJECTID_APPINFO_MAP::iterator p_it = primaries.begin (); + p_it != primaries.end (); + ++p_it) + primary_names.insert (p_it->key ().c_str ()); + + // create a set of strings for the backup names + std::set <std::string> backup_names; + for (size_t rl_i = 0; rl_i < rank_list_.length (); ++rl_i) + backup_names.insert (rank_list_[rl_i].object_id.in ()); + + std::set <std::string> name_union; + std::set_union (primary_names.begin (), primary_names.end (), + backup_names.begin (), backup_names.end (), + std::inserter (name_union, + name_union.begin ())); + + enhanced_rank_list_.length (name_union.size ()); + + std::string object_id; + APP_INFO ai; + + // Add the primary for each ior_list that + // is already in the rank_list. + size_t i = 0; + + for (; i < rank_list_.length (); ++i) + { + object_id = rank_list_[i].object_id.in (); + enhanced_rank_list_[i].object_id = object_id.c_str (); + enhanced_rank_list_[i].now = rank_list_[i].now; + + // Create a new list that is one element larger than the old one. + size_t old_length = rank_list_[i].ior_list.length (); + ObjectList_var list_with_primary (new ObjectList (old_length + 1)); + + // Get primary from the map. + if (primaries.find (object_id.c_str (), ai) == 0) + { + list_with_primary->length (old_length + 1); + + (*list_with_primary)[0] = + CORBA::Object::_duplicate (ai.ior.in ()); + + primaries.unbind (ai.object_id); + + // Add all the other entries behind it. + for (size_t j = 0; j < old_length; ++j) + { + (*list_with_primary)[j + 1] = + CORBA::Object::_duplicate ( + rank_list_[i].ior_list[j].in ()); + } + } + else + { + ACE_DEBUG ((LM_DEBUG, + "RM::send_rank_list - " + "could not find primary for %s.\n", + object_id.c_str ())); + + list_with_primary->length (old_length); + + // Add all the other entries behind it. + for (size_t j = 0; j < old_length; ++j) + { + (*list_with_primary)[j] = + CORBA::Object::_duplicate ( + rank_list_[i].ior_list[j].in ()); + } + } + + // put the new list into the rank list instead of the old one + enhanced_rank_list_[i].ior_list = list_with_primary; + } // end for + + // add primaries for applications that have no entries in the + // rank_list yet. + for (OBJECTID_APPINFO_MAP::iterator pit = primaries.begin (); + !pit.done (); + ++pit) + { + ObjectList_var iorlist (new ObjectList (1)); + iorlist->length (1); + + // add object reference of primary to the list + (*iorlist)[0] = + CORBA::Object::_duplicate ((*pit).item ().ior.in ()); + + enhanced_rank_list_[i].object_id = (*pit).key ().c_str (); + enhanced_rank_list_[i].now = false; + enhanced_rank_list_[i].ior_list = iorlist; + + ++i; + } +} + +void +ReplicationManager_i::send_rank_list (void) +{ + if (! proactive_) + { + return; + } + + ACE_Guard <ACE_Thread_Mutex> guard ( + enhanced_rank_list_agent_list_combined_mutex_); + + for (AGENT_LIST::iterator al_iter = agent_list_.begin (); + al_iter != agent_list_.end (); ) + { + ForwardingAgent_var agent = + ForwardingAgent::_narrow (*al_iter); + + try + { + agent->update_rank_list (enhanced_rank_list_); + ++al_iter; + } + catch (CORBA::SystemException &) + { + ACE_DEBUG ((LM_DEBUG, + "RM: A client agent agent died.\n")); + + // Make sure to remove the failed agent from the list. + AGENT_LIST::iterator tmp_it = al_iter; + ++tmp_it; + agent_list_.remove (*al_iter); + al_iter = tmp_it; + } + } +} + +void +ReplicationManager_i::send_state_synchronization_rank_list (void) +{ + if (! proactive_) + { + return; + } + + ACE_Read_Guard <ACE_RW_Thread_Mutex> guard ( + rank_list_mutex_); + + ACE_Guard <ACE_Thread_Mutex> state_sync_guard ( + state_sync_agent_list_mutex_); + + for (STATE_SYNC_AGENT_MAP::iterator al_iter = + state_synchronization_agent_map_.begin (); + al_iter != state_synchronization_agent_map_.end (); ) + { + StateSynchronizationAgent_var agent = al_iter->item (); + + try + { + agent->update_rank_list (this->rank_list_); + ++al_iter; + } + catch (CORBA::SystemException &) + { + STATE_SYNC_AGENT_MAP::iterator tmp_it = al_iter; + ++tmp_it; + + ACE_CString process_id = al_iter->key (); + + (void) state_synchronization_agent_map_.unbind (al_iter); + al_iter = tmp_it; + + this->proc_failure (process_id.c_str ()); + + ACE_DEBUG ((LM_TRACE, + "RM: A state synchronization agent (pid=%s) died.\n", + process_id.c_str ())); + } + } +} + +void +ReplicationManager_i::update_ior_map ( + ACE_CString const & oid, + std::priority_queue<UtilRank> const & rl) +{ + std::priority_queue <UtilRank> rank_list (rl); + APP_SET app_set; + ACE_Guard <ACE_Recursive_Thread_Mutex> guard (this->appset_lock_); + + // If present... + if (objectid_appset_map_.find (oid, app_set) == 0) + { + RANKED_IOR_LIST ranked_ior_list; + + while (!rank_list.empty ()) + { + UtilRank ur = rank_list.top (); + rank_list.pop (); + + for (APP_SET::iterator as_iter = app_set.begin (); + as_iter != app_set.end (); + ++as_iter) + { + if (ur.host_id == (*as_iter).host_name.c_str ()) + { + ranked_ior_list.ior_list.push_back ( + (*as_iter).ior); + + ranked_ior_list.host_list.push_back( + ACE_CString(ur.host_id.c_str())); + + app_set.remove (*as_iter); + + break; + } + } + } + + RANKED_IOR_LIST temp_ior_list; + + // If not present... + if (objectid_rankedior_map_.find (oid, temp_ior_list) != 0) + { + objectid_rankedior_map_.bind (oid, ranked_ior_list); + } + else + { + objectid_rankedior_map_.rebind (oid, ranked_ior_list); + } + } + else + { + ACE_DEBUG ((LM_ERROR, + "RM: Objectid=%s not present in APP_SET\n", + oid.c_str ())); + } +} + +void +ReplicationManager_i::proc_failure (const char *process_id) +{ + ACE_Guard <ACE_Thread_Mutex> guard(update_mutex_); + ACE_Time_Value wait_time (5); + + while (update_list_.size() >= UPDATE_LIST_MAX_SIZE) + { + if (update_list_full_.wait (update_mutex_, &wait_time) == -1) // timeout + { + ACE_DEBUG ((LM_ERROR, + "RM: proc_failure CORBA upcall waited " + "too long. Skipping proc_failure " + "update. process_id=%s\n", + process_id)); + return; + } + } + + update_list_.insert_tail (MonitorUpdate::create_proc_fail_update(process_id)); + update_available_.broadcast(); +} + +void +ReplicationManager_i::util_update (const char *host_id, + double util) +{ + //ACE_DEBUG ((LM_DEBUG, "Update from %s with UTIL %d\n", host_id, (int)util)); + ACE_Guard <ACE_Thread_Mutex> guard(update_mutex_); + ACE_Time_Value wait_time (5); + + while (update_list_.size() >= UPDATE_LIST_MAX_SIZE) + { + // Timeout + if (update_list_full_.wait (update_mutex_, &wait_time) == -1) + { + ACE_ERROR ((LM_ERROR, + "RM: util_update CORBA upcall " + "waited too long. Skipping " + "util_update. host_id=%s,util=%l\n", + host_id, + util)); + return; + } + } + + update_list_.insert_tail ( + MonitorUpdate::create_host_util_update(host_id,util)); + update_available_.broadcast(); +} + +int +ReplicationManager_i::pulse (void) +{ + ACE_Guard <ACE_Thread_Mutex> guard (update_mutex_); + ACE_Time_Value wait_time (5); + + while (update_list_.size () >= UPDATE_LIST_MAX_SIZE) + { + if (update_list_full_.wait (update_mutex_, &wait_time) == -1) // timeout + { + ACE_ERROR_RETURN ((LM_ERROR, + "RM: pulse waited too long. " + "Skipping pulse.\n"), + 0); + } + } + + update_list_.insert_tail ( + MonitorUpdate::create_run_now_update ()); + update_available_.broadcast (); + + return 0; +} + +RankList * +ReplicationManager_i::register_agent ( + CORBA::Object_ptr agent_reference) +{ + //ACE_DEBUG ((LM_DEBUG, "RM: register_agent () called\n")); + ForwardingAgent_var agent = + ForwardingAgent::_narrow (agent_reference); + + // Make sure the agent gets an up-to-date list. + this->update_enhanced_ranklist (); + + ACE_Guard <ACE_Thread_Mutex> agent_list_guard ( + enhanced_rank_list_agent_list_combined_mutex_); + + this->agent_list_.insert_tail (CORBA::Object::_duplicate (agent.in ())); + + return new RankList (enhanced_rank_list_); +} + +RankList * +ReplicationManager_i::register_state_synchronization_agent ( + const char * /* host_id */, + const char * process_id, + StateSynchronizationAgent_ptr agent) +{ + // ((LM_DEBUG, "RM: register_state_synchronization_agent () called\n")); + + ACE_Guard <ACE_Thread_Mutex> agent_guard ( + state_sync_agent_list_mutex_); + + this->state_synchronization_agent_map_.bind ( + process_id, + StateSynchronizationAgent::_duplicate (agent)); + + ACE_Read_Guard <ACE_RW_Thread_Mutex> rl_guard (rank_list_mutex_); + + return new RankList (rank_list_); +} + + +CORBA::Object_ptr +ReplicationManager_i::get_next (const char * /* object_id */) +{ + return CORBA::Object::_nil (); +} + +void +ReplicationManager_i::set_state (const ::CORBA::Any & state_value) +{ + // ACE_DEBUG ((LM_INFO, "RM: set_state with\n")); + FLARE::ReplicationManager::ReplicationManagerState * value; + + if (state_value >>= value); + else + ACE_DEBUG ((LM_WARNING, + "ReplicationManager_i::set_state () " + "could not extract state value from Any.")); + + for (size_t i = 0; + i < value->utilization.length (); + ++i) + { + hostid_util_map_.bind (CORBA::string_dup(value->utilization[i].hostname), + value->utilization[i].utilization); + } + + for (size_t i = 0; + i < value->app_set_list.length (); + ++i) + { + APP_INFO info (CORBA::string_dup (value->app_set_list[i].object_id.in ()), + value->app_set_list[i].load, + CORBA::string_dup (value->app_set_list[i].host_name.in ()), + CORBA::string_dup (value->app_set_list[i].process_id.in ()), + (value->app_set_list[i].role == FLARE::ReplicationManager::PRIMARY ? PRIMARY : BACKUP), + CORBA::Object::_duplicate (value->app_set_list[i].ior.in ())); + + this->app_reg (info); + } + + // delete old entries and take over new forwarding agent entries + agent_list_.reset (); + for (size_t i = 0; + i < value->forwarding_agents.length (); + ++i) + { + agent_list_.insert_tail ( + CORBA::Object::_duplicate (value->forwarding_agents[i].in ())); + } + + // delete old entries and take over new forwarding agent entries + state_synchronization_agent_map_.unbind_all (); + for (size_t i = 0; + i < value->state_sync_agents.length (); + ++i) + { + state_synchronization_agent_map_.bind ( + value->state_sync_agents[i].process_id.in (), + StateSynchronizationAgent::_duplicate (value->state_sync_agents[i].agent.in ())); + } +} + +CORBA::Any * +ReplicationManager_i::get_state (void) +{ + // create new any object + CORBA::Any_var state (new CORBA::Any); + + FLARE::ReplicationManager::ReplicationManagerState_var value ( + new FLARE::ReplicationManager::ReplicationManagerState ()); + + size_t index = 0; + for (OBJECTID_APPSET_MAP::iterator it = + objectid_appset_map_.begin (); + it != objectid_appset_map_.end (); + ++it) + { + value->app_set_list.length (value->app_set_list.length () + + it->item ().size ()); + + for (APP_SET::iterator ait = + it->item ().begin (); + ait != it->item ().end (); + ++ait) + { + FLARE::ReplicationManager::AppInfo ai; + + ai.object_id = (*ait).object_id.c_str (); + ai.load = (*ait).load; + ai.host_name = (*ait).host_name.c_str (); + ai.process_id = (*ait).process_id.c_str (); + ((*ait).role == PRIMARY ? + ai.role = FLARE::ReplicationManager::PRIMARY : + ai.role = FLARE::ReplicationManager::BACKUP); + ai.ior = CORBA::Object::_duplicate ((*ait).ior.in ()); + + value->app_set_list[index++] = ai; + } + } + + index = 0; + value->forwarding_agents.length (agent_list_.size ()); + for (AGENT_LIST::iterator al_iter = agent_list_.begin (); + al_iter != agent_list_.end (); + ++al_iter) + { + value->forwarding_agents[index++] = + CORBA::Object::_duplicate ((*al_iter).in ()); + } + + index = 0; + value->state_sync_agents.length (state_synchronization_agent_map_.current_size ()); + for (STATE_SYNC_AGENT_MAP::iterator ssal_iter = state_synchronization_agent_map_.begin (); + ssal_iter != state_synchronization_agent_map_.end (); + ++ssal_iter) + { + value->state_sync_agents[index].agent = + StateSynchronizationAgent::_duplicate (ssal_iter->item ().in ()); + value->state_sync_agents[index].process_id = + ssal_iter->key ().c_str (); + } + + index = 0; + value->utilization.length (hostid_util_map_.current_size ()); + FLARE::ReplicationManager::HostUtil util; + for (STRING_TO_DOUBLE_MAP::iterator h_it = hostid_util_map_.begin (); + h_it != hostid_util_map_.end (); + ++h_it) + { + util.hostname = h_it->key ().c_str (); + util.utilization = h_it->item (); + + value->utilization[index++] = util; + } + + // insert value into the any object + *state <<= value._retn (); + + return state._retn (); +} + +StateSynchronizationAgent_ptr +ReplicationManager_i::agent (void) +{ + return StateSynchronizationAgent::_duplicate (agent_.in ()); +} + +void +ReplicationManager_i::agent (StateSynchronizationAgent_ptr agent) +{ + agent_ = agent; +} + +char * +ReplicationManager_i::object_id (void) +{ + return "ReplicationManager"; +} + +void +ReplicationManager_i::object_id (const char * /* object_id */) +{ + // no-op +} + +FLARE::NotificationId +ReplicationManager_i::register_fault_notification ( + FLARE::FaultNotification_ptr receiver) +{ + ACE_Guard <ACE_Thread_Mutex> guard (notify_mutex_); + + if (notify_subscriptions_.bind ( + subscription_counter_, + FLARE::FaultNotification::_duplicate (receiver)) != 0) + { + throw FLARE::NotifyRegistrationError (); + } + + return subscription_counter_++; +} + +void +ReplicationManager_i::unregister_fault_notification ( + FLARE::NotificationId id) +{ + ACE_Guard <ACE_Thread_Mutex> guard (notify_mutex_); + + notify_subscriptions_.unbind (id); +} + +void +ReplicationManager_i::send_failure_notice (const char * host, + const ::FLARE::ApplicationList & object_ids) +{ + ACE_DEBUG ((LM_TRACE, + "RM: '%s' on '%s' failed.\n", + object_ids[0].in (), + host)); + + try + { + ACE_Guard <ACE_Thread_Mutex> guard (notify_mutex_); + + for (NOTIFICATION_MAP::iterator it = notify_subscriptions_.begin (); + it != notify_subscriptions_.end (); + ++it) + { + it->item ()->app_failure (host, object_ids); + } + } + catch (const CORBA::Exception & ex) + { + ACE_DEBUG ((LM_ERROR, + "RM: send_failure_notice - caught %s\n", + ex._info ().c_str ())); + } +} + +void +ReplicationManager_i::set_ranklist_constraints ( + const RankListConstraints & constraints) +{ + ACE_Write_Guard <ACE_RW_Thread_Mutex> guard (constraint_lock_); + + ACE_DEBUG ((LM_TRACE, "RM: received ranklist constraints:\n")); + + RANKLIST_CONSTRAINT constraint; + for (CORBA::ULong i = 0; i < constraints.length (); ++i) + { + ACE_DEBUG ((LM_TRACE, "|\toid %s:", constraints[i].object_id.in ())); + + constraint.clear (); + for (CORBA::ULong j = 0; j < constraints[i].hosts.length (); ++j) + { + ACE_DEBUG ((LM_TRACE, + "\n|\t\t%s", + constraints[i].hosts[j].in ())); + + constraint.push_back (constraints[i].hosts[j].in ()); + } + + ranklist_constraints_.bind (constraints[i].object_id.in (), + constraint); + + ACE_DEBUG ((LM_TRACE, "\n")); + } +} + +MonitorUpdate * +MonitorUpdate::create_proc_fail_update (const char * pid) +{ + ACE_Auto_Ptr<MonitorUpdate> up(new MonitorUpdate ()); + up->process_id = pid; + up->type = MonitorUpdate::PROC_FAIL_UPDATE; + return up.release (); +} + +MonitorUpdate * +MonitorUpdate::create_host_util_update (const char *hid, + double value) +{ + ACE_Auto_Ptr <MonitorUpdate> up (new MonitorUpdate ()); + up->host_id = hid; + up->value = value; + up->type = MonitorUpdate::HOST_UTIL_UPDATE; + return up.release (); +} + +MonitorUpdate * +MonitorUpdate::create_run_now_update (void) +{ + ACE_Auto_Ptr <MonitorUpdate> up (new MonitorUpdate()); + up->type = MonitorUpdate::RUN_NOW; + return up.release (); +} + + +MonitorUpdate * +MonitorUpdate::create_app_info_update (const char *oid, + double l, + const char *hname, + const char *pid, + Role r, + CORBA::Object_ptr ref) +{ + ACE_Auto_Ptr <MonitorUpdate> up (new MonitorUpdate ()); + up->type = MonitorUpdate::APP_REG; + up->app_info = APP_INFO (oid, l, hname, pid, r, ref); + return up.release (); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.h b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.h new file mode 100644 index 00000000000..5fc2bada0c8 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.h @@ -0,0 +1,399 @@ +// -*- C++ -*- +// $Id$ + +#ifndef REPLICATION_MANAGER_H +#define REPLICATION_MANAGER_H + +#include <list> +#include <queue> + +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Unbounded_Queue.h" +#include "ace/Unbounded_Set.h" +#include "ace/Condition_T.h" +#include "ace/Containers_T.h" +#include "ace/Recursive_Thread_Mutex.h" +#include "AppSideReg.h" +#include "Timer.h" + +#include "ReplicationManagerS.h" + +#include "rm_impl_export.h" + +enum Role +{ + PRIMARY = 1, + BACKUP = 2 +}; + +enum AlgoMode +{ + PROCESS_LEVEL = 1, + PROCESSOR_LEVEL = 2 +}; + +class Algorithm; + +struct APP_INFO +{ + ACE_CString object_id; + double load; + ACE_CString host_name; + ACE_CString process_id; + Role role; + CORBA::Object_var ior; + + APP_INFO (void); + + APP_INFO (APP_INFO const & app_info); + + APP_INFO (const char *oid, + double l, + const char *hname, + const char *pid, + Role r, + CORBA::Object_ptr ref); + + APP_INFO (const char *oid, + const char *hname, + const char *pid, + Role r); + + void swap (APP_INFO & app_info); + APP_INFO & operator = (APP_INFO const & app_info); +}; + +bool operator == (APP_INFO const & lhs, APP_INFO const & rhs); + +struct RANKED_IOR_LIST +{ + bool now; + std::list<CORBA::Object_var> ior_list; + std::list<ACE_CString> host_list; + + RANKED_IOR_LIST (void); +}; + +struct UtilRank +{ + double util; + std::string host_id; + + UtilRank (void); + UtilRank (UtilRank const & ur); + UtilRank (double u, const char * hid); +}; + +bool operator < (UtilRank const & u1, UtilRank const & u2); + +struct MonitorUpdate +{ + enum UpdateType + { + PROC_FAIL_UPDATE, + HOST_UTIL_UPDATE, + RUN_NOW, + APP_REG + }; + + UpdateType type; + + ACE_CString process_id; + ACE_CString host_id; + double value; + APP_INFO app_info; + + static MonitorUpdate * + create_proc_fail_update (const char * pid); + + static MonitorUpdate * + create_host_util_update (const char *hid, double value); + + static MonitorUpdate * + create_run_now_update (void); + + static MonitorUpdate * + create_app_info_update (const char *oid, + double l, + const char *hname, + const char *pid, + Role r, + CORBA::Object_ptr ref); +}; + +class RM_Impl_Export ReplicationManager_i + : public virtual POA_ReplicationManager, + protected Timer +{ +public: + ReplicationManager_i (CORBA::ORB_ptr orb, + double hertz, + bool proactive = true, + bool static_mode = false, + AlgoMode mode = PROCESS_LEVEL); + + ~ReplicationManager_i (void); + + virtual void + register_application (const char *object_id, + double load, + const char *host_name, + const char *process_id, + CORBA::Short role, + CORBA::Object_ptr server_reference); + + void + util_update (const char *host_id, + double util); + + virtual void + proc_failure (const char *process_id); + + virtual RankList * + register_agent (CORBA::Object_ptr agent_reference); + + virtual RankList * + register_state_synchronization_agent ( + const char * host_id, + const char * process_id, + StateSynchronizationAgent_ptr agent); + + virtual CORBA::Object_ptr + get_next (const char * object_id); + + virtual void set_state (const ::CORBA::Any & state_value); + + virtual ::CORBA::Any * get_state (void); + + virtual ::StateSynchronizationAgent_ptr agent (void); + + virtual void agent (StateSynchronizationAgent_ptr agent); + + virtual char * object_id (void); + + virtual void object_id (const char * object_id); + + virtual FLARE::NotificationId register_fault_notification ( + FLARE::FaultNotification_ptr receiver); + + virtual void unregister_fault_notification ( + FLARE::NotificationId id); + + virtual void set_ranklist_constraints ( + const RankListConstraints & constraints); + + void + load_based_selection_algo (void); + + void + static_selection_algo (void); + + bool + replica_selection_algo (void); + + typedef ACE_Unbounded_Set<ACE_CString> STRING_LIST; + typedef ACE_Unbounded_Set<APP_INFO> APP_SET; + + typedef ACE_Hash_Map_Manager_Ex< + ACE_CString, + STRING_LIST, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> STRING_TO_STRING_LIST_MAP; + + typedef ACE_Hash_Map_Manager_Ex< + ACE_CString, + ACE_CString, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> STRING_TO_STRING_MAP; + + typedef ACE_Hash_Map_Manager_Ex< + ACE_CString, + double, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> STRING_TO_DOUBLE_MAP; + + typedef ACE_Hash_Map_Manager_Ex< + ACE_CString, + APP_SET, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> OBJECTID_APPSET_MAP; + + typedef ACE_Hash_Map_Manager_Ex< + ACE_CString, + APP_INFO, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> OBJECTID_APPINFO_MAP; + + typedef ACE_Hash_Map_Manager_Ex< + ACE_CString, + RANKED_IOR_LIST, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> OBJECTID_RANKED_IOR_MAP; + + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + CORBA::Object_var, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> + STRING_OBJECT_MAP; + + typedef ACE_Unbounded_Set<CORBA::Object_var> AGENT_LIST; + + typedef ACE_Hash_Map_Manager_Ex < + ACE_CString, + StateSynchronizationAgent_var, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> STATE_SYNC_AGENT_MAP; + + typedef ACE_Hash_Map_Manager_Ex< + FLARE::NotificationId, + FLARE::FaultNotification_var, + ACE_Hash<FLARE::NotificationId>, + ACE_Equal_To<FLARE::NotificationId>, + ACE_Null_Mutex> NOTIFICATION_MAP; + + typedef std::list<ACE_CString> RANKLIST_CONSTRAINT; + + typedef ACE_Hash_Map_Manager_Ex < + ACE_CString, + RANKLIST_CONSTRAINT, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> RANKLIST_CONSTRAINT_MAP; + + enum + { + UPDATE_LIST_MAX_SIZE = 100 + }; + +private: + CORBA::ORB_var orb_; + AppSideReg proc_reg_; + + Algorithm * algo_thread_; + bool standby_; + bool proactive_; + AlgoMode mode_; + + // local StateSynchonizationAgent + StateSynchronizationAgent_var agent_; + + /// This flag disables the usage of host load calculations and + /// therefore enables single host scenarios. + bool static_mode_; + + ACE_DLList <MonitorUpdate> update_list_; + ACE_Thread_Mutex update_mutex_; + ACE_Condition <ACE_Thread_Mutex> update_available_; + ACE_Condition <ACE_Thread_Mutex> update_list_full_; + + OBJECTID_APPSET_MAP objectid_appset_map_; + ACE_Recursive_Thread_Mutex appset_lock_; + OBJECTID_RANKED_IOR_MAP objectid_rankedior_map_; + STRING_TO_DOUBLE_MAP hostid_util_map_; + STRING_TO_DOUBLE_MAP objectid_load_map_; + STRING_TO_STRING_MAP processid_host_map_; + + RANKLIST_CONSTRAINT_MAP ranklist_constraints_; + ACE_RW_Thread_Mutex constraint_lock_; + + STRING_TO_STRING_LIST_MAP processid_backup_map_; + STRING_TO_STRING_LIST_MAP processid_primary_map_; + STRING_TO_STRING_LIST_MAP hostid_process_map_; + + RankList rank_list_; + RankList enhanced_rank_list_; + AGENT_LIST agent_list_; + ACE_RW_Thread_Mutex rank_list_mutex_; + ACE_Thread_Mutex enhanced_rank_list_agent_list_combined_mutex_; + STATE_SYNC_AGENT_MAP state_synchronization_agent_map_; + ACE_Thread_Mutex state_sync_agent_list_mutex_; + + ACE_Thread_Mutex notify_mutex_; + FLARE::NotificationId subscription_counter_; + NOTIFICATION_MAP notify_subscriptions_; + + void update_enhanced_ranklist (void); + + void update_map (const char * key_str, + const char * value_str, + STRING_TO_STRING_LIST_MAP & map); + + void update_util_map (const char * key_str, + double value, + STRING_TO_DOUBLE_MAP & map); + + void update_appset_map (const char * key_str, + APP_INFO const & app_info, + OBJECTID_APPSET_MAP &); + + void update_ior_map (ACE_CString const & oid, + std::priority_queue<UtilRank> const & rank_list); + + void update_proc_host_map (const char *pid, + const char * hid, + STRING_TO_STRING_MAP & map); + + std::priority_queue <UtilRank> + util_sorted_host_list (ACE_CString const & oid, + STRING_LIST const & host_list, + STRING_TO_DOUBLE_MAP const & hu_map); + + virtual int pulse (void); + + void move_update_list (ACE_DLList<MonitorUpdate> & source, + ACE_DLList<MonitorUpdate> & dest); + + bool process_updates(ACE_DLList<MonitorUpdate> & update_list); + + void remove_process(ACE_CString const & pid, + STRING_TO_STRING_LIST_MAP & map, + ACE_CString const & host, + Role role); + + void send_rank_list (void); + + void send_state_synchronization_rank_list (void); + + void build_rank_list (void); + + void app_reg(APP_INFO & app_info); + + void static_ranklist_update (const char * object_id, + CORBA::Object_ptr ior, + Role role); + + void process_proc_failure (ACE_CString const & process_id); + + STRING_LIST non_primary_host_list (ACE_CString const & primary_object_id); + + void replace_primary_tags (ACE_CString const & pid, + ACE_CString const & host); + + void remove_from_appset (ACE_CString const & host, + ACE_CString const & pid, + ACE_CString const & tag, + Role role); + + void elevate_backup_to_primary (ACE_CString const & tag); + + void replace_backup_tags (ACE_CString const & pid, + ACE_CString const & host); + + void copy_map (STRING_TO_DOUBLE_MAP const & source, + STRING_TO_DOUBLE_MAP & dest); + + void print_queue (std::priority_queue <UtilRank> queue); + + void send_failure_notice (const char * host, + const ::FLARE::ApplicationList & object_ids); +}; + +#endif /* REPLICATION_MANAGER_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.idl b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.idl new file mode 100644 index 00000000000..8476ce80009 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ReplicationManager.idl @@ -0,0 +1,41 @@ +// -*- IDL -*- +// $Id$ + +#include "LWFTDataStructures.idl" +#include "StateSynchronizationAgent.idl" +#include "FaultNotification.idl" + +typedef sequence<string> HostList; + +struct RankListConstraint +{ + string object_id; + HostList hosts; +}; + +typedef sequence<RankListConstraint> RankListConstraints; + +interface ReplicationManager : ReplicatedApplication, FLARE::FaultNotifier +{ + RankList register_agent (in Object agent_reference); + + void register_application (in string object_id, + in double load, + in string host_id, + in string process_id, + in short role, + in Object server_reference); + + void set_ranklist_constraints (in RankListConstraints constraints); + + RankList register_state_synchronization_agent ( + in string host_id, + in string process_id, + in StateSynchronizationAgent agent); + + void util_update (in string host_id, in double utilization); + + void proc_failure (in string process_id); + + Object get_next (in string object_id); +}; diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ServerORBInitializer.cpp b/TAO/orbsvcs/orbsvcs/LWFT/ServerORBInitializer.cpp new file mode 100644 index 00000000000..0d8a3e735be --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ServerORBInitializer.cpp @@ -0,0 +1,47 @@ +#include "ServerORBInitializer.h" +#include "IOR_Interceptor.h" +#include "tao/ORB_Constants.h" +#include "tao/PortableServer/PortableServer.h" + +ACE_RCSID (Hello, + ServerORBInitializer, + "$Id$") + +void +ServerORBInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr /* info */) +{ +} + +void +ServerORBInitializer::post_init ( + PortableInterceptor::ORBInitInfo_ptr info) +{ + + CORBA::Object_var obj = + info->resolve_initial_references ("POACurrent"); + + PortableServer::Current_var poa_current = + PortableServer::Current::_narrow (obj.in ()); + + ACE_ASSERT (!CORBA::is_nil (poa_current.in ())); + + + CORBA::String_var orb_id = info->orb_id (); + + // Create and register the test's IORInterceptor + + PortableInterceptor::IORInterceptor_ptr ior_intercept; + ACE_NEW_THROW_EX (ior_intercept, + IOR_Interceptor, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + ENOMEM), + CORBA::COMPLETED_NO)); + + PortableInterceptor::IORInterceptor_var ior_interceptor = + ior_intercept; + + info->add_ior_interceptor (ior_interceptor.in ()); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ServerORBInitializer.h b/TAO/orbsvcs/orbsvcs/LWFT/ServerORBInitializer.h new file mode 100644 index 00000000000..5393086df07 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ServerORBInitializer.h @@ -0,0 +1,52 @@ +// -*- C++ -*- +// $Id$ + +#ifndef SERVER_ORB_INITIALIZER_H +#define SERVER_ORB_INITIALIZER_H + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PI/PI.h" +#include "tao/LocalObject.h" + +#include "lwft_server_export.h" + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +class LWFT_Server_Export ServerORBInitializer + : public virtual PortableInterceptor::ORBInitializer, + public virtual TAO_Local_RefCounted_Object +{ +public: + + /** + * @name Methods Required by the ORBInitializer Interface + * + * These are methods that must be implemented since they are pure + * virtual in the abstract base class. They are the canonical + * methods required for all ORB initializers. + */ + //@{ + /// The pre-initialization hook. + virtual void pre_init ( + PortableInterceptor::ORBInitInfo_ptr info); + + /// The post-initialization hook. + virtual void post_init ( + PortableInterceptor::ORBInitInfo_ptr info); + //@} + +}; + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#endif /* SERVER_ORB_INITIALIZER_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.cpp b/TAO/orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.cpp new file mode 100644 index 00000000000..6f477a869a2 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.cpp @@ -0,0 +1,91 @@ +// -*- C++ -*- +// $Id$ + +#include "tao/PortableServer/POAC.h" + +#include "Barrier_Guard.h" + +#include "StateSyncAgentTask.h" +#include "StateSynchronizationAgent_i.h" + +StateSyncAgentTask::StateSyncAgentTask ( + CORBA::ORB_ptr orb, + StateSynchronizationAgent_i * agent) + : orb_ (CORBA::ORB::_duplicate (orb)), + agent_ (agent), + sync_ (2), + agent_ref_ (StateSynchronizationAgent::_nil ()) +{ +} + +int +StateSyncAgentTask::svc (void) +{ + try + { + { + Barrier_Guard barrier_guard (sync_); + + CORBA::Object_var object = + this->orb_->resolve_initial_references ("RootPOA"); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (object.in ()); + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (); + + // *************************************************** + // activate state synchronzation agent + + PortableServer::ObjectId_var ssa_oid = + root_poa->activate_object (agent_); + + CORBA::Object_var ssa_object = + root_poa->id_to_reference (ssa_oid.in ()); + + agent_ref_ = + StateSynchronizationAgent::_narrow (ssa_object.in ()); + + poa_manager->activate (); + } + + this->orb_->run (); + + this->orb_->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("SSA task thread: exception caught:"); + return 1; + } + + return 0; +} + +int +StateSyncAgentTask::activate (long /* flags */, + int /* n_threads */, + int /* force_active */, + long /* priority */, + int /* grp_id */, + ACE_Task_Base* /* task */, + ACE_hthread_t /* thread_handles */ [], + void* /* stack */ [], + size_t /* stack_size */ [], + ACE_thread_t /* thread_ids */ [], + const char* /* thr_name */ []) +{ + // This will end up back in our overridden svc() method. We + // want to wait for it to execute the statements in its body + // before returning control to the calling application. + int retval = this->ACE_Task_Base::activate (); + sync_.wait (); + return retval; +} + +StateSynchronizationAgent_ptr +StateSyncAgentTask::agent_ref (void) +{ + return agent_ref_.in (); +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.h b/TAO/orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.h new file mode 100644 index 00000000000..06e60e14548 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/StateSyncAgentTask.h @@ -0,0 +1,54 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file StateSyncAgentTask.h + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _STATE_SYNC_AGENT_TASK_H_ +#define _STATE_SYNC_AGENT_TASK_H_ + +#include "ace/Task.h" +#include "ace/Barrier.h" +#include "StateSynchronizationAgent_i.h" +#include "ssa_export.h" + +class SSA_Export StateSyncAgentTask : public ACE_Task_Base +{ +public: + StateSyncAgentTask (CORBA::ORB_ptr orb, + StateSynchronizationAgent_i * agent); + + virtual int svc (void); + + // Override, calls base class activate(), then wait() on barrier. + virtual int activate (long flags = THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, + int n_threads = 1, + int force_active = 0, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + int grp_id = -1, + ACE_Task_Base *task = 0, + ACE_hthread_t thread_handles[] = 0, + void *stack[] = 0, + size_t stack_size[] = 0, + ACE_thread_t thread_ids[] = 0, + const char* thr_name[] = 0); + + StateSynchronizationAgent_ptr agent_ref (void); + + private: + CORBA::ORB_var orb_; + + StateSynchronizationAgent_i * agent_; + + ACE_Barrier sync_; + + StateSynchronizationAgent_var agent_ref_; +}; + +#endif /* _STATE_SYNC_AGENT_TASK_H_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent.idl b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent.idl new file mode 100644 index 00000000000..76a2e61040a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent.idl @@ -0,0 +1,35 @@ +// -*- IDL -*- + +//============================================================================= +/** + * @file StateSynchronizationAgent.idl + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _STATE_SYNCHRONIZATION_AGENT_IDL_ +#define _STATE_SYNCHRONIZATION_AGENT_IDL_ + +#include "ReplicatedApplication.idl" +#include "LWFTDataStructures.idl" + +interface StateSynchronizationAgent +{ + /// Triggers an serial update of the state information + /// to all registered replicas. + void state_changed (in string object_id); + + /// Used by the ReplicationManager to update information about + /// active replicas. + void update_rank_list (in RankList replicas); + + /// Informs the replication manager about applications for which + /// it is responsible for replication. + void register_application (in string object_id, + in ReplicatedApplication app); +}; + +#endif /* _STATE_SYNCHRONIZATION_AGENT_IDL_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.cpp b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.cpp new file mode 100644 index 00000000000..76634ae1217 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.cpp @@ -0,0 +1,391 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file StateSynchronizationAgent_i.cpp + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#include <string> + +#include "StateSynchronizationAgent_i.h" +#include "CorbaStateUpdate.h" + +#ifdef FLARE_USES_DDS +# include "DDSStateUpdate_T.h" +#endif + +StateSynchronizationAgent_i::StateSynchronizationAgent_i ( + CORBA::ORB_ptr orb, + const std::string & host_id, + const std::string & process_id, + bool use_corba) + : orb_ (CORBA::ORB::_duplicate (orb)), + host_id_ (host_id), + process_id_ (process_id), +#if defined (FLARE_USES_DDS) + domain_id_ (0),//"FLAREDomain"), + domain_participant_ (DDS::DomainParticipant::_nil ()), + publisher_ (DDS::Publisher::_nil ()), + subscriber_ (DDS::Subscriber::_nil ()), +#endif /* FLARE_USES_DDS */ + use_corba_ (use_corba) +{ +#if defined (FLARE_USES_DDS) + if (!use_corba_) + { + if (!this->create_participant ()) + { + throw DDSFailure ("SSA could not create DDS participant\n"); + } + + if (!this->create_publisher ()) + { + throw DDSFailure ("SSA could not create DDS publisher\n"); + } + + if (!this->create_subscriber ()) + { + throw DDSFailure ("SSA could not create DDS subscriber\n"); + } + } +#endif /* FLARE_USES_DDS */ +} + +StateSynchronizationAgent_i::~StateSynchronizationAgent_i (void) +{ +#ifdef FLARE_USES_DDS + if (!use_corba_) + { + DDS::ReturnCode_t status = + domain_participant_->delete_contained_entities (); + + if (status != DDS::RETCODE_OK) + { + ACE_ERROR ((LM_ERROR, + "SSA - " + "Bad retcode from delete_contained_entities()\n")); + } + + if (! this->delete_participant ()) + { + ACE_ERROR ((LM_ERROR, + "SSA - " + "Bad retcode from delete_participant()\n")); + } + } +#endif /* FLARE_USES_DDS */ +} + +void +StateSynchronizationAgent_i::state_changed (const char * object_id) +{ + /* + ACE_DEBUG ((LM_TRACE, + "SSA::state_changed (%s) called.\n", + object_id)); + */ + // get application reference + ReplicatedApplication_var app; + + if (application_map_.find (ACE_CString (object_id), + app) != 0) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) SSA::state_changed () " + "could not find application for object id %s\n", + object_id)); + return; + } + + // Get state from the application. + CORBA::Any_var state; + + try + { + state = app->get_state (); + } + catch (const CORBA::SystemException& ex) + { + ACE_DEBUG ((LM_ERROR, + "(%P|%t) SSA::state_changed () " + "exception while calling the " + "get_state method for application " + "%s:\n" + "%s", + object_id, + ex._info ().c_str ())); + return; + } + + // Send state to each element in the replica_map_. + ReplicaGroup replica_group; + + if (replica_map_.find (ACE_CString (object_id), + replica_group) != 0) + { + /* + ACE_ERROR ((LM_WARNING, + "(%P|%t) SSA::state_changed () " + "could not find replicas for the application %s\n", + object_id)); + */ + return; + } + + ReplicatedApplication_var replica; + + for (REPLICA_OBJECT_LIST::iterator it = replica_group.replicas.begin (); + it != replica_group.replicas.end (); + ++it) + { + try + { + // Set the state on this replica. + (*it)->set_state (state.in ()); + } + catch (const CORBA::SystemException& ex) + { + ACE_DEBUG ((LM_WARNING, + "(%P|%t) SSA::state_changed () " + "exception while contacting a " + "server replica for %s.\n", + object_id)); + } + } +} + +void +StateSynchronizationAgent_i::update_rank_list (const RankList & rank_list) +{ + if (use_corba_) + { + // If only corba is used, we can simply reset the map. + replica_map_.close (); + replica_map_.open (); + } + else + { + // only remove entries replicated by CORBA + for (OBJECTID_REPLICA_MAP::iterator it = replica_map_.begin (); + it != replica_map_.end (); + ++it) + { + if (!it->item ().use_dds) + { + replica_map_.unbind (it); + } + } + } + + ACE_DEBUG ((LM_INFO, + "SSA::update_rank_list with:\n")); + + // for each replication group in the replica group list + for (size_t i = 0; i < rank_list.length (); ++i) + { + ACE_DEBUG ((LM_INFO, + "\toid = %s (%d entries)\n", + rank_list[i].object_id.in (), + rank_list[i].ior_list.length ())); + + // Use the application id as a key for the map. + ACE_CString oid (rank_list[i].object_id); + + // If there is already an entry for this object_id it means that + // we have a registered DDS object and should not override it. + if (replica_map_.find (oid) != 0) + { + // Create a new list for every replication group. + ReplicaGroup replica_group; + replica_group.use_dds = false; + + // For each entry of a replica group... + for (size_t j = 0; + j < rank_list[i].ior_list.length (); + ++j) + { + try + { + // it is assumed that the strings identifying + // rank_list are stringified object references and + // can be resolved and used to contact the + // corresponding StateSynchronizationAgent. + replica_group.replicas.push_back ( + STATEFUL_OBJECT_PTR ( + new CorbaStateUpdate ( + rank_list[i].ior_list[j]))); + } + catch (const CORBA::SystemException& ex) + { + /* + ACE_DEBUG (( + LM_WARNING, + "(%P|%t) SSA::" + "update_rank_list could not resolve stringified " + "object reference for %s : %s\n", + oid.c_str (), + ex._info ().c_str ())); + */ + } + } + + // Add one replication group to the map. + replica_map_.bind (oid, replica_group); + } + } +} + +void +StateSynchronizationAgent_i::register_application ( + const char * object_id, + ReplicatedApplication_ptr app) +{ + //ACE_DEBUG ((LM_TRACE, + // "SSA::register_application (%s) called.\n", object_id)); + + ACE_CString oid (object_id); + + if (application_map_.bind (oid, ReplicatedApplication::_duplicate (app)) < 0) + { + ACE_DEBUG ((LM_WARNING, + "(%P|%t) SSA::register_application () " + "could not bind application %s to " + "the map successfully\n", + object_id)); + } +} + +#ifdef FLARE_USES_DDS + +bool +StateSynchronizationAgent_i::create_participant (void) +{ + DDS::DomainParticipantFactory_var dpf + = DDS::DomainParticipantFactory::get_instance (); + + if (CORBA::is_nil (dpf.in ())) + { + return false; + } + + domain_participant_ = + dpf->create_participant ( + domain_id_, + PARTICIPANT_QOS_DEFAULT, + DDS::DomainParticipantListener::_nil (), + DDS::ANY_STATUS); + + if (CORBA::is_nil (domain_participant_.in ())) + { + return false; + } + + return true; +} + +bool +StateSynchronizationAgent_i::delete_participant (void) +{ + DDS::DomainParticipantFactory_var dpf + = DDS::DomainParticipantFactory::get_instance (); + + if (CORBA::is_nil (dpf.in ())) + { + return false; + } + + DDS::ReturnCode_t status = + dpf->delete_participant (domain_participant_.in ()); + + if (status != DDS::RETCODE_OK) + { + return false; + } + + return true; +} + +bool +StateSynchronizationAgent_i::create_publisher (void) +{ + DDS::PublisherQos pub_qos; + domain_participant_->get_default_publisher_qos (pub_qos); + + publisher_ = + domain_participant_->create_publisher ( + pub_qos, + DDS::PublisherListener::_nil (), + DDS::ANY_STATUS); + + if (CORBA::is_nil (publisher_.in ())) + { + return false; + } + + return true; +} + +bool +StateSynchronizationAgent_i::delete_publisher (void) +{ + DDS::ReturnCode_t status = + domain_participant_->delete_publisher (publisher_.in ()); + + if (status != DDS::RETCODE_OK) + { + return false; + } + + return true; +} + +bool +StateSynchronizationAgent_i::create_subscriber (void) +{ + subscriber_ = + domain_participant_->create_subscriber ( + SUBSCRIBER_QOS_DEFAULT, + DDS::SubscriberListener::_nil (), + DDS::ANY_STATUS); + + if (CORBA::is_nil (subscriber_.in ())) + { + return false; + } + + return true; +} + +bool +StateSynchronizationAgent_i::delete_subscriber (void) +{ + DDS::ReturnCode_t status = + domain_participant_->delete_subscriber (subscriber_.in ()); + + if (status != DDS::RETCODE_OK) + { + return false; + } + + return true; +} + +#endif /* FLARE_USES_DDS */ + +std::string +StateSynchronizationAgent_i::get_unique_id ( + const std::string & app_name) +{ + std::string unique_id (app_name); + + // Make name unique by adding host and process id. + unique_id += "_" + host_id_ + "_" + process_id_; + + return unique_id; +} + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h new file mode 100644 index 00000000000..792d1b71b89 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h @@ -0,0 +1,139 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file StateSynchronizationAgent_i.h + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef STATE_SYNCHRONIZATION_AGENT_I_H_ +#define STATE_SYNCHRONIZATION_AGENT_I_H_ + +#include <list> +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Thread_Mutex.h" +#include "ace/Refcounted_Auto_Ptr.h" +#include "StateSynchronizationAgentS.h" +#include "StatefulObject.h" +#include "ssa_export.h" + +#if defined (FLARE_USES_DDS) +# include <ccpp_dds_dcps.h> +# include "DDSFailure.h" +#endif + +class SSA_Export StateSynchronizationAgent_i + : public POA_StateSynchronizationAgent +{ + public: + /// ctor + /// @param reference to a simple long value representing + /// the state of the application + StateSynchronizationAgent_i (CORBA::ORB_ptr orb, + const std::string & host_id, + const std::string & process_id, + bool use_corba = true); + + /// dtor + ~StateSynchronizationAgent_i (void); + + /// Implementation of the StateSynchronizationAgent interface. + virtual void state_changed (const char * object_id); + + /// Implementation of the StateSynchronizationAgent interface. + virtual void update_rank_list (const RankList & rank_list); + + /// Registers application for statesynchronization with CORBA. + virtual void register_application (const char * object_id, + ReplicatedApplication_ptr app); + +#ifdef FLARE_USES_DDS + /// Registers application for state synchronization with DDS + template <typename DATA_TYPE> + void register_application_with_dds (const char * object_id, + ReplicatedApplication_ptr app); +#endif /* FLARE_USES_DDS */ + + typedef + ACE_Refcounted_Auto_Ptr <StatefulObject, + ACE_Null_Mutex> + STATEFUL_OBJECT_PTR; + + typedef std::list<STATEFUL_OBJECT_PTR> REPLICA_OBJECT_LIST; + + struct ReplicaGroup + { + REPLICA_OBJECT_LIST replicas; + bool use_dds; + }; + + typedef ACE_Hash_Map_Manager_Ex< + ACE_CString, + ReplicaGroup, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Thread_Mutex> OBJECTID_REPLICA_MAP; + + typedef ACE_Hash_Map_Manager_Ex< + ACE_CString, + ReplicatedApplication_var, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> OBJECTID_APPLICATION_MAP; + +#ifdef FLARE_USES_DDS + + bool create_participant (void); + bool delete_participant (void); + bool create_publisher (void); + bool delete_publisher (void); + bool create_subscriber (void); + bool delete_subscriber (void); + +#endif /* FLARE_USES_DDS */ + + std::string get_unique_id (const std::string & app_name); + +private: + /// orb reference + CORBA::ORB_var orb_; + + /// host on which the agent is running + std::string host_id_; + + /// process in which the agent is running + std::string process_id_; + + /// keeps lists of replicas associated to application ids + OBJECTID_REPLICA_MAP replica_map_; + + /// keeps references to all applications running in this process + OBJECTID_APPLICATION_MAP application_map_; + +#ifdef FLARE_USES_DDS + + /// id of the DDS domain + DDS::DomainId_t domain_id_; + + /// DDS Domain Participant + DDS::DomainParticipant_var domain_participant_; + + /// DDS Publisher for this Domain + DDS::Publisher_var publisher_; + + /// DDS Subscriber for this Domain + DDS::Subscriber_var subscriber_; + +#endif /* FLARE_USES_DDS */ + + /// decides whether replicas should be updated through corba or dds + bool use_corba_; +}; + +#include "StateSynchronizationAgent_i_T.cpp" + +#endif /* STATE_SYNCHRONIZATION_AGENT_I_H_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i_T.cpp b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i_T.cpp new file mode 100644 index 00000000000..5e088554a3d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i_T.cpp @@ -0,0 +1,84 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file StateSynchronizationAgent_i_T.cpp + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef STATE_SYNCHRONIZATION_AGENT_I_T_CPP_ +#define STATE_SYNCHRONIZATION_AGENT_I_T_CPP_ + +#ifdef FLARE_USES_DDS + +#include "DDSStateUpdate_T.h" + +template <typename DATA_TYPE> +void +StateSynchronizationAgent_i::register_application_with_dds ( + const char * object_id, + ReplicatedApplication_ptr app) +{ +/* + ACE_DEBUG ((LM_TRACE, + "SSA::register_application_with_dds (%s) called.\n", + object_id)); +*/ + ACE_CString oid (object_id); + + if (application_map_.bind (oid, + ReplicatedApplication::_duplicate (app)) != 0) + { + ACE_DEBUG ((LM_WARNING, + "(%P|%t) SSA::register_application_with_dds () " + "could not bind application %s to " + "the map successfully\n", + object_id)); + } + + if (!use_corba_) + { + try + { + /* + ACE_DEBUG ((LM_TRACE, + "SSA::register_application_with_dds add DDS participant" + " for application %s\n", + object_id)); + */ + // create a new list which will have only one entry for DDS + ReplicaGroup replica_group; + replica_group.use_dds = true; + + // register a DDS participant for this application + replica_group.replicas.push_back ( + typename StateSynchronizationAgent_i::STATEFUL_OBJECT_PTR ( + new DDSStateUpdate_T <DATA_TYPE> ( + oid.c_str (), + this->get_unique_id (oid.c_str ()), + domain_participant_.in (), + publisher_.in (), + subscriber_.in (), + app))); + + ACE_CString oid (object_id); + + // this should work without doing a rebind, since there is + // only one application of the same type per process + replica_map_.bind (oid, replica_group); + } + catch (const DDSFailure & ex) + { + ACE_ERROR ((LM_ERROR, + "SSA::register_application_with_dds () DDS problem : %s\n", + ex.description ().c_str ())); + } + } // end !use_corba_ +} +#endif /* FLARE_USES_DDS */ + +#endif /* STATE_SYNCHRONIZATION_AGENT_I_T_CPP_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/StatefulObject.cpp b/TAO/orbsvcs/orbsvcs/LWFT/StatefulObject.cpp new file mode 100644 index 00000000000..78d3b7bd249 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/StatefulObject.cpp @@ -0,0 +1,21 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file StatefulObject.cpp + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#include "StatefulObject.h" + +StatefulObject::StatefulObject (void) +{ +} + +StatefulObject::~StatefulObject (void) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/StatefulObject.h b/TAO/orbsvcs/orbsvcs/LWFT/StatefulObject.h new file mode 100644 index 00000000000..092f48d80c1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/StatefulObject.h @@ -0,0 +1,47 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file StatefulObject.h + * + * $Id$ + * + * @author Friedhelm Wolf (fwolf@dre.vanderbilt.edu) + */ +//============================================================================= + +#ifndef _STATEFUL_OBJECT_H_ +#define _STATEFUL_OBJECT_H_ + +#include "ssa_export.h" + +// forward declaration +namespace CORBA +{ + class Any; +}; + +/** + * @class StatefulObject + * + * @brief Abstract Base class for objects that have a set_state method. + * + * This class shields differences in how to disseminate state throughout + * the system (e.g. either by standard CORBA calls, AMI or DDS) from + * the state synchronization agent + */ +class SSA_Export StatefulObject +{ +public: + + /// ctor + StatefulObject (); + + /// dtor + virtual ~StatefulObject (); + + /// method to set the + virtual void set_state (const ::CORBA::Any & state_value) = 0; +}; + +#endif /* _STATEFUL_OBJECT_H_ */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Timer.cpp b/TAO/orbsvcs/orbsvcs/LWFT/Timer.cpp new file mode 100644 index 00000000000..2d0b5800029 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Timer.cpp @@ -0,0 +1,171 @@ +// -*- C++ -*- +// $Id$ + +#include "Timer.h" + +#include "ace/Timer_Queue.h" +#include "ace/Reactor.h" + +//================================================================= + +// constructor +Timer::Timer (void) + : done_ (0), + active_ (0), + hertz_ (0), + tid_ (0) +{ + // Setup a reactor different from what the ORB is using that we shall use + // exclusively for timer capabilities. + this->reactor (new ACE_Reactor); +} + +// destructor +Timer::~Timer (void) +{ + delete this->reactor (); + this->reactor (0); +} + +// get our attribute +double +Timer::hertz (void) +{ + return this->hertz_; +} + +// set our attribute +void +Timer::hertz (double h) +{ + this->hertz_ = h; +} + +// start the timer +void +Timer::start (void) +{ + // we are using this step in case we want to restart the timer capabilities + // again + this->done_ = 0; + + // check if parameters are valid + if (this->hertz_ == 0 || this->active_ !=0) { // Not valid + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("[Timer::start] ") + ACE_TEXT ("Bad Parameters\n"))); + // we should throw some exception + return; + } + + // start an active object that will handle events - particularly timeout + // events + if (this->activate () == -1) { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("[Timer::start] ") + ACE_TEXT ("Active object activation failed (%p)\n"))); + // we should throw some exception + return; + } + + // we are now active + this->active_ = 1; + + long interval = static_cast<long> (1000000 / this->hertz_); + + // start a periodic timer + this->tid_ = this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, interval), + ACE_Time_Value (0, interval)); + + if (this->tid_ == -1) { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("[Timer::start] ") + ACE_TEXT ("Scheduling timer failed (%p)\n"))); + // We should throw some exception. + return; + } + + // Success. +} + +/// Stopping the timer. +void +Timer::stop (void) +{ + if (this->active_ == 0) { // Not valid. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("[Timer::stop] ") + ACE_TEXT ("bad parameter\n"))); + // We should throw some exception. + return; + } + + /// Cancel the timer. + this->reactor ()->cancel_timer (this); + + /// We are no longer active. + this->active_ = 0; + + /// Asynchronous notification to the active object thread. + this->done_ = 1; + + /// Send an event to the reactor which will invoke handle_close(). + this->reactor ()->notify (); + + ///ACE_DEBUG ((LM_DEBUG, "Waiting\n")); + + /// Wait for the active object thread to quit. + this->wait (); +} + +// Callback function from the timeout handler. +int +Timer::pulse (void) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("obtain utilization input\n"))); + + return 0; +} + +// Handling the timeout. +int +Timer::handle_timeout (const ACE_Time_Value &, + const void *) +{ + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("[Timer::handle_timeout] - timeout\n"))); + // timeout has occured. Time to callback. The callback function will do the + // RM's job of getting utilization info from the hosts. + return this->pulse (); +} + +// Cleanup. +int +Timer::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + + return 0; +} + +// active object thread +int +Timer::svc (void) +{ + // set the owner + this->reactor ()->owner (ACE_OS::thr_self ()); + + // continue until someone stops us asynchronously + while (!this->done_) + this->reactor ()->handle_events (); + + return 0; +} + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Timer.h b/TAO/orbsvcs/orbsvcs/LWFT/Timer.h new file mode 100644 index 00000000000..a7ff1ed1400 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Timer.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +// $Id$ + +//============================================================ +/** + * @file Timer.h + * + * taken from basic sp timer code + * @author + */ +//============================================================ + +#ifndef TIMER_H +#define TIMER_H + +#include "ace/Task.h" + +#include "lwft_common_export.h" + +/** + * @class Timer + * + */ +class LWFT_Common_Export Timer : public ACE_Task_Base +{ +public: + /// Default constructor. + Timer (void); + + /// Default destructor. + ~Timer (void); + + double hertz (void); + void hertz (double h); + void start (void); + void stop (void); + + /// Helper function to be called back after a timeout + virtual int pulse (void); + + /// timer related functions including the active object svc function which + /// runs our timer + + /// Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + /// Called when <Time_Handler> is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + virtual int svc (void); + +protected: + /// Flag to indicate completion of this active object. + int done_; + + /// flag to indicate if we are already activated + int active_; + + /// Frequency + double hertz_; + + /// The timer id we are waiting. + long tid_; +}; + +#endif /* TIMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Utilization_Monitor.cpp b/TAO/orbsvcs/orbsvcs/LWFT/Utilization_Monitor.cpp new file mode 100644 index 00000000000..0b828f40449 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Utilization_Monitor.cpp @@ -0,0 +1,51 @@ +// -*- C++ -*- +// $Id$ + +#include "ace/Log_Msg.h" +#include "ace/Monitor_Control/Monitor_Control.h" + +#include "Utilization_Monitor.h" +#include "HMOptions.h" + +Utilization_Monitor::Utilization_Monitor (void) +: load_ (0.0), + outfile_ (HMOptions::instance ()->util_file ().c_str ()) +{ +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + + load_calc_ = create_os_monitor<CPU_LOAD_MONITOR> (); + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ +} + +Utilization_Monitor::~Utilization_Monitor (void) +{ +} + +int +Utilization_Monitor::pulse (void) +{ + //ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Utilization_Monitor::pulse\n"))); +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + + load_calc_->update (); + Monitor_Control_Types::Data data (load_calc_->type ()); + load_calc_->retrieve (data); + load_ = data.value_; + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + + outfile_ << load_ << std::endl; + + return 0; +} + +double Utilization_Monitor::percent_load (void) +{ + return load_; +} + +void Utilization_Monitor::set_RM_Proxy (RM_Proxy *rm_proxy) +{ + this->rm_proxy_ = rm_proxy; +} diff --git a/TAO/orbsvcs/orbsvcs/LWFT/Utilization_Monitor.h b/TAO/orbsvcs/orbsvcs/LWFT/Utilization_Monitor.h new file mode 100644 index 00000000000..ae112f56f92 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/Utilization_Monitor.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +// $Id$ + +#ifndef UTILIZATION_MONITOR_H +#define UTILIZATION_MONITOR_H + +#include <fstream> + +#include "Timer.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Monitor_Manager.h" +#include "host_monitor_export.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +using namespace ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control; + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +class RM_Proxy; + +class HostMonitor_Export Utilization_Monitor : protected Timer +{ +public: + using Timer::start; + using Timer::stop; + using Timer::hertz; + + Utilization_Monitor (void); + virtual ~Utilization_Monitor (void); + + /// Helper function to be called back after a timeout. + virtual int pulse (void); + virtual double percent_load (void); + void set_RM_Proxy (RM_Proxy *rm_proxy); + +private: + Monitor_Manager load_calc_; + RM_Proxy *rm_proxy_; + double load_; + std::ofstream outfile_; +}; + +#endif /* UTILIZATION_MONITOR_H */ diff --git a/TAO/orbsvcs/orbsvcs/LWFT/host_monitor_export.h b/TAO/orbsvcs/orbsvcs/LWFT/host_monitor_export.h new file mode 100644 index 00000000000..bb7a5a8c01e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/host_monitor_export.h @@ -0,0 +1,59 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl HOSTMONITOR +// ------------------------------ +#ifndef HOSTMONITOR_EXPORT_H +#define HOSTMONITOR_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (HOSTMONITOR_HAS_DLL) +# define HOSTMONITOR_HAS_DLL 0 +# endif /* ! HOSTMONITOR_HAS_DLL */ +#else +# if !defined (HOSTMONITOR_HAS_DLL) +# define HOSTMONITOR_HAS_DLL 1 +# endif /* ! HOSTMONITOR_HAS_DLL */ +#endif + +#if defined (HOSTMONITOR_HAS_DLL) && (HOSTMONITOR_HAS_DLL == 1) +# if defined (HOSTMONITOR_BUILD_DLL) +# define HostMonitor_Export ACE_Proper_Export_Flag +# define HOSTMONITOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define HOSTMONITOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* HOSTMONITOR_BUILD_DLL */ +# define HostMonitor_Export ACE_Proper_Import_Flag +# define HOSTMONITOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define HOSTMONITOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* HOSTMONITOR_BUILD_DLL */ +#else /* HOSTMONITOR_HAS_DLL == 1 */ +# define HostMonitor_Export +# define HOSTMONITOR_SINGLETON_DECLARATION(T) +# define HOSTMONITOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* HOSTMONITOR_HAS_DLL == 1 */ + +// Set HOSTMONITOR_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (HOSTMONITOR_NTRACE) +# if (ACE_NTRACE == 1) +# define HOSTMONITOR_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define HOSTMONITOR_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !HOSTMONITOR_NTRACE */ + +#if (HOSTMONITOR_NTRACE == 1) +# define HOSTMONITOR_TRACE(X) +#else /* (HOSTMONITOR_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define HOSTMONITOR_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (HOSTMONITOR_NTRACE == 1) */ + +#endif /* HOSTMONITOR_EXPORT_H */ + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/lwft_client_export.h b/TAO/orbsvcs/orbsvcs/LWFT/lwft_client_export.h new file mode 100644 index 00000000000..3237fe956be --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/lwft_client_export.h @@ -0,0 +1,59 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl LWFT_Client +// ------------------------------ +#ifndef LWFT_CLIENT_EXPORT_H +#define LWFT_CLIENT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (LWFT_CLIENT_HAS_DLL) +# define LWFT_CLIENT_HAS_DLL 0 +# endif /* ! LWFT_CLIENT_HAS_DLL */ +#else +# if !defined (LWFT_CLIENT_HAS_DLL) +# define LWFT_CLIENT_HAS_DLL 1 +# endif /* ! LWFT_CLIENT_HAS_DLL */ +#endif + +#if defined (LWFT_CLIENT_HAS_DLL) && (LWFT_CLIENT_HAS_DLL == 1) +# if defined (LWFT_CLIENT_BUILD_DLL) +# define LWFT_Client_Export ACE_Proper_Export_Flag +# define LWFT_CLIENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define LWFT_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* LWFT_CLIENT_BUILD_DLL */ +# define LWFT_Client_Export ACE_Proper_Import_Flag +# define LWFT_CLIENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define LWFT_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* LWFT_CLIENT_BUILD_DLL */ +#else /* LWFT_CLIENT_HAS_DLL == 1 */ +# define LWFT_Client_Export +# define LWFT_CLIENT_SINGLETON_DECLARATION(T) +# define LWFT_CLIENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* LWFT_CLIENT_HAS_DLL == 1 */ + +// Set LWFT_CLIENT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (LWFT_CLIENT_NTRACE) +# if (ACE_NTRACE == 1) +# define LWFT_CLIENT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define LWFT_CLIENT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !LWFT_CLIENT_NTRACE */ + +#if (LWFT_CLIENT_NTRACE == 1) +# define LWFT_CLIENT_TRACE(X) +#else /* (LWFT_CLIENT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define LWFT_CLIENT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (LWFT_CLIENT_NTRACE == 1) */ + +#endif /* LWFT_CLIENT_EXPORT_H */ + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/lwft_common_export.h b/TAO/orbsvcs/orbsvcs/LWFT/lwft_common_export.h new file mode 100644 index 00000000000..1acc3adeab4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/lwft_common_export.h @@ -0,0 +1,40 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef LWFT_COMMON_EXPORT_H +#define LWFT_COMMON_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (LWFT_COMMON_HAS_DLL) +# define LWFT_COMMON_HAS_DLL 0 +# endif /* ! LWFT_COMMON_HAS_DLL */ +#else +# if !defined (LWFT_COMMON_HAS_DLL) +# define LWFT_COMMON_HAS_DLL 1 +# endif /* ! LWFT_COMMON_HAS_DLL */ +#endif + +#if defined (LWFT_COMMON_HAS_DLL) && (LWFT_COMMON_HAS_DLL == 1) +# if defined (LWFT_COMMON_BUILD_DLL) +# define LWFT_Common_Export ACE_Proper_Export_Flag +# define LWFT_COMMON_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define LWFT_COMMON_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* LWFT_COMMON_BUILD_DLL */ +# define LWFT_Common_Export ACE_Proper_Import_Flag +# define LWFT_COMMON_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define LWFT_COMMON_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* LWFT_COMMON_BUILD_DLL */ +#else /* LWFT_COMMON_HAS_DLL == 1 */ +# define LWFT_Common_Export +# define LWFT_COMMON_SINGLETON_DECLARATION(T) +# define LWFT_COMMON_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* LWFT_COMMON_HAS_DLL == 1 */ + +#endif /* LWFT_COMMON_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/orbsvcs/orbsvcs/LWFT/lwft_server_export.h b/TAO/orbsvcs/orbsvcs/LWFT/lwft_server_export.h new file mode 100644 index 00000000000..efe400e948c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/lwft_server_export.h @@ -0,0 +1,40 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef LWFT_SERVER_EXPORT_H +#define LWFT_SERVER_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (LWFT_SERVER_HAS_DLL) +# define LWFT_SERVER_HAS_DLL 0 +# endif /* ! LWFT_SERVER_HAS_DLL */ +#else +# if !defined (LWFT_SERVER_HAS_DLL) +# define LWFT_SERVER_HAS_DLL 1 +# endif /* ! LWFT_SERVER_HAS_DLL */ +#endif + +#if defined (LWFT_SERVER_HAS_DLL) && (LWFT_SERVER_HAS_DLL == 1) +# if defined (LWFT_SERVER_BUILD_DLL) +# define LWFT_Server_Export ACE_Proper_Export_Flag +# define LWFT_SERVER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define LWFT_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* LWFT_SERVER_BUILD_DLL */ +# define LWFT_Server_Export ACE_Proper_Import_Flag +# define LWFT_SERVER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define LWFT_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* LWFT_SERVER_BUILD_DLL */ +#else /* LWFT_SERVER_HAS_DLL == 1 */ +# define LWFT_Server_Export +# define LWFT_SERVER_SINGLETON_DECLARATION(T) +# define LWFT_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* LWFT_SERVER_HAS_DLL == 1 */ + +#endif /* LWFT_SERVER_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/orbsvcs/orbsvcs/LWFT/rm_export.h b/TAO/orbsvcs/orbsvcs/LWFT/rm_export.h new file mode 100644 index 00000000000..1ffa9b4ec2c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/rm_export.h @@ -0,0 +1,59 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl RM +// ------------------------------ +#ifndef RM_EXPORT_H +#define RM_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (RM_HAS_DLL) +# define RM_HAS_DLL 0 +# endif /* ! RM_HAS_DLL */ +#else +# if !defined (RM_HAS_DLL) +# define RM_HAS_DLL 1 +# endif /* ! RM_HAS_DLL */ +#endif + +#if defined (RM_HAS_DLL) && (RM_HAS_DLL == 1) +# if defined (RM_BUILD_DLL) +# define RM_Export ACE_Proper_Export_Flag +# define RM_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define RM_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* RM_BUILD_DLL */ +# define RM_Export ACE_Proper_Import_Flag +# define RM_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define RM_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* RM_BUILD_DLL */ +#else /* RM_HAS_DLL == 1 */ +# define RM_Export +# define RM_SINGLETON_DECLARATION(T) +# define RM_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* RM_HAS_DLL == 1 */ + +// Set RM_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (RM_NTRACE) +# if (ACE_NTRACE == 1) +# define RM_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define RM_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !RM_NTRACE */ + +#if (RM_NTRACE == 1) +# define RM_TRACE(X) +#else /* (RM_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define RM_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (RM_NTRACE == 1) */ + +#endif /* RM_EXPORT_H */ + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/rm_impl_export.h b/TAO/orbsvcs/orbsvcs/LWFT/rm_impl_export.h new file mode 100644 index 00000000000..9c6ac7e071e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/rm_impl_export.h @@ -0,0 +1,59 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl RM +// ------------------------------ +#ifndef RM_IMPL_EXPORT_H +#define RM_IMPL_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (RM_IMPL_HAS_DLL) +# define RM_IMPL_HAS_DLL 0 +# endif /* ! RM_IMPL_HAS_DLL */ +#else +# if !defined (RM_IMPL_HAS_DLL) +# define RM_IMPL_HAS_DLL 1 +# endif /* ! RM_IMPL_HAS_DLL */ +#endif + +#if defined (RM_IMPL_HAS_DLL) && (RM_IMPL_HAS_DLL == 1) +# if defined (RM_IMPL_BUILD_DLL) +# define RM_Impl_Export ACE_Proper_Export_Flag +# define RM_IMPL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define RM_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* RM_IMPL_BUILD_DLL */ +# define RM_Impl_Export ACE_Proper_Import_Flag +# define RM_IMPL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define RM_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* RM_IMPL_BUILD_DLL */ +#else /* RM_IMPL_HAS_DLL == 1 */ +# define RM_Impl_Export +# define RM_IMPL_SINGLETON_DECLARATION(T) +# define RM_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* RM_IMPL_HAS_DLL == 1 */ + +// Set RM_IMPL_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (RM_IMPL_NTRACE) +# if (ACE_NTRACE == 1) +# define RM_IMPL_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define RM_IMPL_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !RM_IMPL_NTRACE */ + +#if (RM_IMPL_NTRACE == 1) +# define RM_IMPL_TRACE(X) +#else /* (RM_IMPL_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define RM_IMPL_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (RM_IMPL_NTRACE == 1) */ + +#endif /* RM_IMPL_EXPORT_H */ + diff --git a/TAO/orbsvcs/orbsvcs/LWFT/ssa_export.h b/TAO/orbsvcs/orbsvcs/LWFT/ssa_export.h new file mode 100644 index 00000000000..b976cc310b4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LWFT/ssa_export.h @@ -0,0 +1,59 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SSA +// ------------------------------ +#ifndef SSA_EXPORT_H +#define SSA_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (SSA_HAS_DLL) +# define SSA_HAS_DLL 0 +# endif /* ! SSA_HAS_DLL */ +#else +# if !defined (SSA_HAS_DLL) +# define SSA_HAS_DLL 1 +# endif /* ! SSA_HAS_DLL */ +#endif + +#if defined (SSA_HAS_DLL) && (SSA_HAS_DLL == 1) +# if defined (SSA_BUILD_DLL) +# define SSA_Export ACE_Proper_Export_Flag +# define SSA_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SSA_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SSA_BUILD_DLL */ +# define SSA_Export ACE_Proper_Import_Flag +# define SSA_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SSA_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SSA_BUILD_DLL */ +#else /* SSA_HAS_DLL == 1 */ +# define SSA_Export +# define SSA_SINGLETON_DECLARATION(T) +# define SSA_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SSA_HAS_DLL == 1 */ + +// Set SSA_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SSA_NTRACE) +# if (ACE_NTRACE == 1) +# define SSA_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SSA_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SSA_NTRACE */ + +#if (SSA_NTRACE == 1) +# define SSA_TRACE(X) +#else /* (SSA_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SSA_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SSA_NTRACE == 1) */ + +#endif /* SSA_EXPORT_H */ + |