diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2014-10-21 16:05:27 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2014-10-21 16:05:27 +0000 |
commit | ad262a1f2bbbd3aae266ca215663f00f00d4148d (patch) | |
tree | bb3af8f5cd1f08873bdf413e805f096ad2ed164b /TAO/orbsvcs | |
parent | 81891bd2d21d1529fbd74d01206e8ffaca973713 (diff) | |
download | ATCD-ad262a1f2bbbd3aae266ca215663f00f00d4148d.tar.gz |
Tue Oct 21 16:03:14 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
* orbsvcs/ImplRepo_Service/ImR_Locator_i.h:
* orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp:
* orbsvcs/ImplRepo_Service/Locator_Options.h:
* orbsvcs/ImplRepo_Service/Locator_Options.cpp:
* orbsvcs/ImplRepo_Service/README:
Add a configuration parameter for ping timeout.
Diffstat (limited to 'TAO/orbsvcs')
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp | 38 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/Locator_Options.h | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/README | 10 |
5 files changed, 60 insertions, 11 deletions
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp index 13c6ffdfb56..7bbafb863a8 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp @@ -21,8 +21,6 @@ #include "ace/OS_NS_sys_time.h" #include "ace/Vector_T.h" -static const ACE_Time_Value DEFAULT_SERVER_TIMEOUT (0, 10 * 1000); // 10ms - /// We want to give shutdown a little more time to work, so that we /// can guarantee to the tao_imr utility that it has shutdown. The tao_imr /// utility prints a different message depending on whether shutdown succeeds @@ -60,7 +58,10 @@ ImR_Locator_i::ImR_Locator_i (void) , ins_locator_ (0) , aam_set_ () , read_only_ (false) + , startup_timeout_ (60) , ping_external_ (false) + , ping_interval_ (10) + , ping_timeout_ (1) , unregister_if_address_reused_ (false) , throw_shutdown_exceptions_ (false) { @@ -90,6 +91,7 @@ ImR_Locator_i::init_with_orb (CORBA::ORB_ptr orb, Options& opts) this->startup_timeout_ = opts.startup_timeout (); this->ping_external_ = opts.ping_external (); this->ping_interval_ = opts.ping_interval (); + this->ping_timeout_ = opts.ping_timeout (); this->unregister_if_address_reused_ = opts.unregister_if_address_reused (); this->throw_shutdown_exceptions_ = opts.throw_shutdown_exceptions (); CORBA::Object_var obj = @@ -1075,7 +1077,7 @@ ImR_Locator_i::server_is_running if (this->unregister_if_address_reused_) this->repository_->unregister_if_address_reused (id, partial_ior, this); - CORBA::Object_var obj = this->set_timeout_policy (server_object,ACE_Time_Value (1,0)); + CORBA::Object_var obj = this->set_timeout_policy (server_object, this->ping_timeout_); ImplementationRepository::ServerObject_var srvobj = ImplementationRepository::ServerObject::_narrow (obj.in()); @@ -1287,9 +1289,9 @@ ImR_Locator_i::connect_activator (Activator_Info& info) return; } - if (startup_timeout_ > ACE_Time_Value::zero) + if (this->startup_timeout_ > ACE_Time_Value::zero) { - obj = this->set_timeout_policy (obj.in (), startup_timeout_); + obj = this->set_timeout_policy (obj.in (), this->startup_timeout_); } info.activator = @@ -1383,7 +1385,7 @@ ImR_Locator_i::connect_server (UpdateableServerInfo& info) return; } - obj = this->set_timeout_policy (obj.in (), DEFAULT_SERVER_TIMEOUT); + obj = this->set_timeout_policy (obj.in (), this->ping_timeout_); sip->server = ImplementationRepository::ServerObject::_unchecked_narrow (obj.in ()); @@ -1637,4 +1639,3 @@ ImR_Loc_ResponseHandler::send_exception (CORBA::Exception *ex) }; delete this; } - diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h index 882aead7a13..ecc48a9cdf5 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h @@ -223,6 +223,8 @@ private: ACE_Time_Value startup_timeout_; bool ping_external_; ACE_Time_Value ping_interval_; + ACE_Time_Value ping_timeout_; + bool unregister_if_address_reused_; bool throw_shutdown_exceptions_; }; diff --git a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp index c0d33fee8f5..2d3ac930c26 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp @@ -21,6 +21,7 @@ static const ACE_TCHAR *SERVICE_REG_PATH = #endif /* ACE_WIN32 */ static const int DEFAULT_PING_INTERVAL = 10; // seconds +static const int DEFAULT_PING_TIMEOUT = 1; // seconds static const int DEFAULT_START_TIMEOUT = 60; // seconds Options::Options () @@ -31,6 +32,7 @@ Options::Options () , service_ (false) , ping_external_ (false) , ping_interval_ (DEFAULT_PING_INTERVAL) +, ping_timeout_ (DEFAULT_PING_TIMEOUT) , startup_timeout_ (DEFAULT_START_TIMEOUT) , readonly_ (false) , service_command_ (SC_NONE) @@ -250,6 +252,21 @@ Options::parse_args (int &argc, ACE_TCHAR *argv[]) this->ping_interval_ = ACE_Time_Value (0, 1000 * ACE_OS::atoi (shifter.get_current ())); } + else if (ACE_OS::strcasecmp (shifter.get_current (), + ACE_TEXT ("-n")) == 0) + { + shifter.consume_arg (); + + if (!shifter.is_anything_left () || shifter.get_current ()[0] == '-') + { + ORBSVCS_ERROR ((LM_ERROR, + ACE_TEXT ("Error: -n option needs a value\n"))); + this->print_usage (); + return -1; + } + this->ping_timeout_ = + ACE_Time_Value (0, 1000 * ACE_OS::atoi (shifter.get_current ())); + } else { shifter.ignore_arg (); @@ -383,6 +400,11 @@ Options::save_registry_options () (LPBYTE) &tmp, sizeof (DWORD)); ACE_ASSERT (err == ERROR_SUCCESS); + tmp = this->ping_timeout_.msec (); + err = ACE_TEXT_RegSetValueEx (key, ACE_TEXT ("PingTimeout"), 0, REG_DWORD, + (LPBYTE) &tmp, sizeof (DWORD)); + ACE_ASSERT (err == ERROR_SUCCESS); + tmp = this->readonly_ ? 1 : 0; err = ACE_TEXT_RegSetValueEx (key, ACE_TEXT ("Lock"), 0, REG_DWORD, (LPBYTE) &tmp, sizeof (DWORD)); @@ -482,6 +504,16 @@ Options::load_registry_options () tmp = 0; sz = sizeof(tmp); + err = ACE_TEXT_RegQueryValueEx (key, ACE_TEXT ("PingTimeout"), 0, &type, + (LPBYTE) &tmp, &sz); + if (err == ERROR_SUCCESS) + { + ACE_ASSERT (type == REG_DWORD); + ping_timeout_.msec (static_cast<long> (tmp)); + } + + tmp = 0; + sz = sizeof(tmp); err = ACE_TEXT_RegQueryValueEx (key, ACE_TEXT ("Lock"), 0, &type, (LPBYTE) &tmp, &sz); if (err == ERROR_SUCCESS) @@ -600,6 +632,12 @@ Options::ping_interval (void) const return this->ping_interval_; } +ACE_Time_Value +Options::ping_timeout (void) const +{ + return this->ping_timeout_; +} + LiveCheck * Options::pinger (void) const { diff --git a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.h b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.h index 9a485ddfa5a..38c0d45e34c 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.h +++ b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.h @@ -108,6 +108,9 @@ public: /// during indirect invocations, if this interval has elapsed. ACE_Time_Value ping_interval (void) const; + /// When pinging, this is the timeout + ACE_Time_Value ping_timeout (void) const; + LiveCheck *pinger (void) const; void pinger (LiveCheck *); @@ -156,6 +159,9 @@ private: /// The amount of time between successive "are you started yet?" pings. ACE_Time_Value ping_interval_; + /// The amount of time to wait for a "are you started yet?" ping reply. + ACE_Time_Value ping_timeout_; + /// The amount of time to wait for a server to response after starting it. ACE_Time_Value startup_timeout_; diff --git a/TAO/orbsvcs/ImplRepo_Service/README b/TAO/orbsvcs/ImplRepo_Service/README index f2c1e22099c..51b9aa9cb6c 100644 --- a/TAO/orbsvcs/ImplRepo_Service/README +++ b/TAO/orbsvcs/ImplRepo_Service/README @@ -37,8 +37,8 @@ as the specification for TAO's ImR. The guy who first worked on ImR and provided a base for the current ImR is Darrell Brunsch @<<a href="mailto:brunsch@cs.wustl.edu">brunsch@cs.wustl.edu</a>@>. -The current version is developed by Priyanka Gontla -@<<a href="mailto:gontla_p@ociweb.com">gontla_p@ociweb.com</a>@>. +The current version is developed by Phil Mesnier +@<<a href="mailto:mesnier_p@ociweb.com">mesnier_p@ociweb.com</a>@>. You can reach us by either email (which is better), or through the <a href="http://www.cs.wustl.edu/~schmidt/ACE-mail.html">ACE mailing list</a> @<<a href="mailto:ace-useres@cs.wustl.edu">ace-users@cs.wustl.edu</a>@>, @@ -90,7 +90,10 @@ Commandline Arguments that can be passed to tao_imr_locator -m support multicast discovery. -l lock the repository, making it read only. -o <filename> write the ior to the file. --t <timeout> specify a startup timeout value +-t <timeout> specify a startup timeout value (default 60 seconds) +-i periodically ping servers to check liveness. +-v the minimum succcessful ping interval. (default 10 seconds) +-g the timeout for ping attempts. (default 1 second) -s run as a winNT service -c <command> execute the named service command: install, remove -x <filename> support persistence to the locator. We use XML to support @@ -532,4 +535,3 @@ name. And that allows us to do interesting things with ORBDefaultInitRef (as shown in the @ref defaultinitref section). */ - |