diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-05 15:05:23 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-03-05 15:05:23 +0000 |
commit | 4a5e90e672eeaddd81f8f39b6c2c4299bf091295 (patch) | |
tree | 06b6f3a3815abeed6c9dd07a30964efc81c57df1 | |
parent | 1c4e37633ca0244192961124328b4d885d721f9d (diff) | |
download | ATCD-4a5e90e672eeaddd81f8f39b6c2c4299bf091295.tar.gz |
ChangeLogTag: Thu Mar 5 15:02:30 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 16 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp | 94 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h | 2 |
4 files changed, 70 insertions, 45 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index c3b62a5d953..61090d4c4bd 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,19 @@ +Thu Mar 5 15:02:30 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu> + + * orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h: + + Cosmetic changes. + + * orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp: + * orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h: + + Moved the call to register_process() on the HostMonitor + out of svc() to the overridden activate(), after the + base class activate() returns. This call must wait until + the heartbeat socket is set up, which happens in svc(). + Thanks to Friedhelm Wolf <fwolf@dre.vanderbilt.edu> for + pointing this out. + Thu Mar 5 03:21:39 UTC 2009 Friedhelm Wolf <fwolf@dre.vanderbilt.edu> * orbsvcs/orbsvcs/LWFT/AppOptions.cpp: diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp index 7031369aaa7..7379e4b920a 100644 --- a/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.cpp @@ -16,7 +16,6 @@ #include "AppSideMonitor_Thread.h" #include "AppOptions.h" -#include "HostMonitorC.h" AppSideMonitor_Thread* AppSideMonitor_Thread::instance (void) @@ -69,9 +68,9 @@ AppSideMonitor_Thread::svc (void) 1); } - hmvar = HostMonitor::_narrow (obj.in ()); + hmvar_ = HostMonitor::_narrow (obj.in ()); - if (CORBA::is_nil (hmvar.in ())) + if (CORBA::is_nil (hmvar_.in ())) { ACE_ERROR_RETURN ((LM_ERROR, "AppSideMonitor_Thread::svc: " @@ -93,7 +92,7 @@ AppSideMonitor_Thread::svc (void) { try { - port_ = hmvar->heartbeat_port (); + port_ = hmvar_->heartbeat_port (); } catch (CORBA::Exception &ex) { @@ -108,44 +107,9 @@ AppSideMonitor_Thread::svc (void) port_ = AppOptions::instance ()->port (); } - 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_ERROR_RETURN ((LM_ERROR, - "Registeration with the monitor " - "failed. Maybe the " - "hostmonitor needs to be set to " - "another " - "port range.\n"), - 1); - } - } - catch (CORBA::Exception &ex) - { - ACE_PRINT_EXCEPTION (ex, - "AppSideMonitor_Thread::svc: " - "HostMonitor::register_process():"); - return -1; - } +// ACE_DEBUG ((LM_TRACE, +// "AppSideReg::svc - got heartbeat port " +// "%d from hm.\n", port_)); if (serv_addr_.set (port_) == -1) { @@ -211,9 +175,51 @@ AppSideMonitor_Thread::activate (long /* flags */, int retval = this->ACE_Task_Base::activate (); sync_.wait (); + if (retval != 0) + { + return retval; + } + + AppOptions *app_opts = AppOptions::instance (); + // Keep a reference to the monitor singleton. - AppOptions::instance ()->monitor (this); + app_opts->monitor (this); - return retval; + try + { + CORBA::Boolean good_register = + hmvar_->register_process (app_opts->process_id ().c_str (), + app_opts->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_ERROR_RETURN ((LM_ERROR, + "Registeration with the monitor " + "failed. Maybe the " + "hostmonitor needs to be set to " + "another " + "port range.\n"), + 1); + } + } + catch (CORBA::Exception &ex) + { + ACE_PRINT_EXCEPTION (ex, + "AppSideMonitor_Thread::svc: " + "HostMonitor::register_process():"); + return -1; + } + + return 0; } diff --git a/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h index 97466a68c33..20efdc2519c 100644 --- a/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h +++ b/TAO/orbsvcs/orbsvcs/LWFT/AppSideMonitor_Thread.h @@ -20,7 +20,7 @@ #include "ace/Synch_Traits.h" #include "AppSideMonitor_Handler.h" -#include "lwft_server_export.h" +#include "HostMonitorC.h" /** * @class AppSideMonitor_Thread @@ -65,6 +65,7 @@ private: ACE_Acceptor<AppSideMonitor_Handler, ACE_SOCK_Acceptor> acceptor_; ACE_Barrier sync_; bool activated_; + HostMonitor_var hmvar_; }; diff --git a/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h index 792d1b71b89..e333910a25e 100644 --- a/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h +++ b/TAO/orbsvcs/orbsvcs/LWFT/StateSynchronizationAgent_i.h @@ -14,9 +14,11 @@ #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" |