diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2013-04-09 14:43:35 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2013-04-09 14:43:35 +0000 |
commit | d0685ae4587b1e0c21b3192e108f34bb0380077b (patch) | |
tree | 3c83364823be8ecc410716caaa15e5936d201e14 | |
parent | 79b07433f0adb2b5a61f8d18550408fd8563085c (diff) | |
download | ATCD-d0685ae4587b1e0c21b3192e108f34bb0380077b.tar.gz |
Tue Apr 9 14:42:10 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r-- | TAO/ChangeLog_Asynch_ImR | 14 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp | 66 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/LiveCheck.h | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/ImplRepo/servers_list/Terminator.cpp | 1 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl | 8 |
6 files changed, 84 insertions, 17 deletions
diff --git a/TAO/ChangeLog_Asynch_ImR b/TAO/ChangeLog_Asynch_ImR index 2e08c71138a..97ddfda16b9 100644 --- a/TAO/ChangeLog_Asynch_ImR +++ b/TAO/ChangeLog_Asynch_ImR @@ -1,3 +1,17 @@ +Tue Apr 9 14:42:10 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> + + * orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp: + * orbsvcs/ImplRepo_Service/LiveCheck.h: + * orbsvcs/ImplRepo_Service/LiveCheck.cpp: + + Improve the list performance by forcing a poll if an active + test is required. + + * orbsvcs/tests/ImplRepo/servers_list/Terminator.cpp: + * orbsvcs/tests/ImplRepo/servers_list/run_test.pl: + + enhance the debugging output. + Mon Apr 8 19:02:29 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> * orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp: diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp index 4787d4a555f..d8e8e520a88 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp @@ -1389,19 +1389,20 @@ SyncListener::SyncListener (const char *server, bool SyncListener::is_alive (void) { +#if 0 this->status_ = this->pinger_.is_alive(this->server()); if (this->status_ == LS_ALIVE) return true; else if (this->status_ == LS_DEAD) return false; - +#endif this->callback_ = true; while (!this->got_it_) { if (this->callback_) { - if (!this->pinger_.add_listener (this)) + if (!this->pinger_.add_poll_listener (this)) { return false; } @@ -1411,6 +1412,7 @@ SyncListener::is_alive (void) this->orb_->perform_work (delay); } this->got_it_ = false; + ACE_DEBUG ((LM_DEBUG, "SyncListener::is_alive returning %d (stat = %d)\n", status_ != LS_DEAD, status_)); return this->status_ != LS_DEAD; } diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp index 63be8e1fe1c..38356c1aa33 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp @@ -26,24 +26,33 @@ int LiveEntry::reping_limit_ = sizeof (LiveEntry::reping_msec_) / sizeof (int); void LiveEntry::set_reping_limit (int max) { - LiveEntry::reping_limit_ = max; + int array_max = sizeof (LiveEntry::reping_msec_) / sizeof (int); + LiveEntry::reping_limit_ = max < array_max && max >= 0 ? max : array_max; } bool LiveEntry::reping_available (void) { - return this->repings_ < LiveEntry::reping_limit_; + return this->repings_ < this->max_retry_; } int LiveEntry::next_reping (void) { - if ( this->repings_ < LiveEntry::reping_limit_) + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, -1); + return this->reping_available() ? LiveEntry::reping_msec_[this->repings_++] : -1; +} + +void +LiveEntry::max_retry_msec (int msec) +{ + ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); + for (this->max_retry_ = 0; + this->max_retry_ < LiveEntry::reping_limit_ && msec > 0; + ++this->max_retry_) { - return LiveEntry::reping_msec_[this->repings_++]; + msec -= LiveEntry::reping_msec_[this->repings_]; } - else - return -1; } LiveEntry::LiveEntry (LiveCheck *owner, @@ -56,6 +65,7 @@ LiveEntry::LiveEntry (LiveCheck *owner, next_check_ (ACE_High_Res_Timer::gettimeofday_hr()), retry_count_ (0), repings_ (0), + max_retry_ (LiveEntry::reping_limit_), listeners_ (), lock_ () { @@ -72,6 +82,17 @@ LiveEntry::add_listener (LiveListener* ll) this->listeners_.insert (ll); } +void +LiveEntry::reset_status (void) +{ + ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); + if ( this->liveliness_ == LS_ALIVE) + { + this->liveliness_ = LS_UNKNOWN; + this->next_check_ = ACE_High_Res_Timer::gettimeofday_hr(); + } +} + LiveStatus LiveEntry::status (void) const { @@ -93,14 +114,13 @@ LiveEntry::status (LiveStatus l) { ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); this->liveliness_ = l; + if (l == LS_ALIVE) + { + this->retry_count_ = 0; + ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr()); + this->next_check_ = now + owner_->ping_interval(); + } } - if (l == LS_ALIVE) - { - this->retry_count_ = 0; - ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr()); - this->next_check_ = now + owner_->ping_interval(); - } - Listen_Set remove; LiveStatus ls = this->liveliness_; @@ -447,6 +467,26 @@ LiveCheck::add_per_client_listener (LiveListener *l, } bool +LiveCheck::add_poll_listener (LiveListener *l) +{ + if (!this->running_) + return false; + + LiveEntry *entry = 0; + ACE_CString key (l->server()); + int result = entry_map_.find (key, entry); + if (result == -1 || entry == 0) + { + return false; + } + + entry->add_listener (l); + entry->reset_status (); + this->schedule_ping (entry); + return true; +} + +bool LiveCheck::add_listener (LiveListener *l) { if (!this->running_) diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h index 8b39415e124..798ecbdcc5c 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h @@ -100,11 +100,14 @@ class Locator_Export LiveEntry void add_listener (LiveListener * ll); LiveStatus status (void) const; void status (LiveStatus l); + void reset_status (void); + bool do_ping (PortableServer::POA_ptr poa); const ACE_Time_Value &next_check (void) const; static void set_reping_limit (int max); bool reping_available (void); int next_reping (void); + void max_retry_msec (int max); private: LiveCheck *owner_; @@ -114,6 +117,7 @@ class Locator_Export LiveEntry ACE_Time_Value next_check_; short retry_count_; int repings_; + int max_retry_; typedef ACE_Unbounded_Set<LiveListener *> Listen_Set; Listen_Set listeners_; @@ -179,6 +183,8 @@ class Locator_Export LiveCheck : public ACE_Event_Handler bool add_listener (LiveListener *listener); + bool add_poll_listener (LiveListener *listener); + bool add_per_client_listener (LiveListener *listener, ImplementationRepository::ServerObject_ptr ref); diff --git a/TAO/orbsvcs/tests/ImplRepo/servers_list/Terminator.cpp b/TAO/orbsvcs/tests/ImplRepo/servers_list/Terminator.cpp index 88fb72467bf..71444a35adc 100644 --- a/TAO/orbsvcs/tests/ImplRepo/servers_list/Terminator.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/servers_list/Terminator.cpp @@ -39,6 +39,7 @@ Terminator::svc() } int delay_secs = ACE_OS::atoi(mb->rd_ptr()); ACE_OS::sleep(delay_secs); + ACE_DEBUG ((LM_DEBUG, "(%P) Terminator::svc() aborting after sleep of %d seconds\n", delay_secs)); ACE_OS::abort(); } return 0; diff --git a/TAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl index ce08bde5187..4e21a973e94 100755 --- a/TAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl +++ b/TAO/orbsvcs/tests/ImplRepo/servers_list/run_test.pl @@ -305,8 +305,12 @@ sub servers_list_test my $result = 0; my $start_time = time(); - - $IMR->Arguments ("-d 0 -v 1000 -o $imr_imriorfile -orbendpoint iiop://:$port"); + my $verbose_logging = ""; + if ($debug_level > 0) { + $verbose_logging = "-ORBDebugLevel 10 -ORBVerboseLogging 1 -ORBLogFile imr_loc.log"; + } + print "starting IMR with command line: -d $debug_level $verbose_logging -v 1000 -o $imr_imriorfile -orbendpoint iiop://:$port\n"; + $IMR->Arguments ("-d $debug_level $verbose_logging -v 1000 -o $imr_imriorfile -orbendpoint iiop://:$port"); ##### Start ImplRepo ##### $IMR_status = $IMR->Spawn (); |