From 0980fa0ffeef2c2deb1f21b7fef8f2e2795d06b7 Mon Sep 17 00:00:00 2001 From: Phil Mesnier Date: Mon, 8 Apr 2013 17:13:49 +0000 Subject: Mon Apr 8 17:13:01 UTC 2013 Phil Mesnier --- TAO/ChangeLog_Asynch_ImR | 8 +++ .../ImplRepo_Service/AsyncAccessManager.cpp | 7 +++ TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp | 70 +++++++++++----------- TAO/orbsvcs/ImplRepo_Service/LiveCheck.h | 4 +- 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/TAO/ChangeLog_Asynch_ImR b/TAO/ChangeLog_Asynch_ImR index 96a92e16d36..242927a0a57 100644 --- a/TAO/ChangeLog_Asynch_ImR +++ b/TAO/ChangeLog_Asynch_ImR @@ -1,3 +1,11 @@ +Mon Apr 8 17:13:01 UTC 2013 Phil Mesnier + + * orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp: + * orbsvcs/ImplRepo_Service/LiveCheck.h: + * orbsvcs/ImplRepo_Service/LiveCheck.cpp: + + More work on PER_CLIENT activations. + Mon Apr 8 03:29:47 UTC 2013 Phil Mesnier * orbsvcs/ImplRepo_Service/AsyncAccessManager.h: diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp index d22a3c10ed2..8df64afd7a1 100644 --- a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp @@ -51,6 +51,8 @@ AsyncAccessManager::add_interest (ImR_ResponseHandler *rh) if (this->info_->activation_mode == ImplementationRepository::PER_CLIENT) { + ACE_DEBUG ((LM_DEBUG, "AAM adding PerClient interest, this=%x\n", this)); + if (!this->send_start_request()) { this->final_state(); @@ -164,6 +166,8 @@ AsyncAccessManager::status (AAM_Status s) void AsyncAccessManager::activator_replied (bool success) { + ACE_DEBUG ((LM_DEBUG, "AAM activator_replied PerClient, this=%x, success = %d\n", this, success)); + if (success) { this->status (AAM_WAIT_FOR_RUNNING); @@ -190,11 +194,14 @@ AsyncAccessManager::server_is_running (const char *partial_ior, this->info_->partial_ior = partial_ior; this->info_->server = ImplementationRepository::ServerObject::_duplicate (ref); + ACE_DEBUG ((LM_DEBUG, "AAM server_is_running PerClient, this=%x, calling is_alive\n", this)); + if (this->locator_.pinger().is_alive (this->info_->name.c_str())) { this->status (AAM_SERVER_READY); this->final_state (); } + ACE_DEBUG ((LM_DEBUG, "AAM server_is_running PerClient, this=%x, prepaing for ping\n", this)); // This is not a leak. The listener registers with // the pinger and will delete itself when done. diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp index b0d874c2644..9edaa668ef2 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp @@ -140,6 +140,10 @@ LiveEntry::status (LiveStatus l) { this->owner_->schedule_ping (this); } + else + { + this->owner_->remove_per_client_entry (this); + } } const ACE_Time_Value & @@ -193,6 +197,9 @@ LiveEntry::do_ping (PortableServer::POA_ptr poa) this->liveliness_ = LS_PING_AWAY; this->retry_count_++; } + + ACE_DEBUG ((LM_DEBUG, "do_ping sending request for entry = %x\n", this)); + PortableServer::ServantBase_var callback = new PingReceiver (this, poa); PortableServer::ObjectId_var oid = poa->activate_object (callback.in()); CORBA::Object_var obj = poa->id_to_reference (oid.in()); @@ -317,9 +324,9 @@ LiveCheck::handle_timeout (const ACE_Time_Value &, bool want_reping = false; ACE_Time_Value next; - LiveEntryMap::iterator the_end = this->entry_map_.end(); + LiveEntryMap::iterator le_end = this->entry_map_.end(); for (LiveEntryMap::iterator le = this->entry_map_.begin(); - le != the_end; + le != le_end; ++le) { if (le->item ()->do_ping (poa_.in ())) @@ -336,53 +343,43 @@ LiveCheck::handle_timeout (const ACE_Time_Value &, } } -#if 0 - for (LiveEntryMap::iterator le (this->entry_map_); - !le.done (); - le.advance ()) - { - LiveEntryMap::value_type *pair = 0; - le.next(pair); - if (pair->item()->do_ping (poa_.in ())) - { - LiveStatus status = pair->item ()->status (); - if (status != LS_DEAD) - { - if (!want_reping || pair->item ()->next_check() < next) - { - want_reping = true; - next = pair->item ()->next_check(); - } - } - } - } -#endif - for (PerClientStack::ITERATOR pe (this->per_client_); - !pe.done (); - pe.advance ()) + + PerClientStack::iterator pe_end = this->per_client_.end(); + int i = 0; + for (PerClientStack::iterator pe = this->per_client_.begin(); + pe != pe_end; + ++pe) { - LiveEntry **entry = 0; - pe.next(entry); - if (*entry != 0) + LiveEntry *entry = *pe; + ACE_DEBUG ((LM_DEBUG, "Checking PerClient entry[%d] %x\n",i++, entry)); + if (entry != 0) { - bool result = (*entry)->do_ping (poa_.in ()); - LiveStatus status = (*entry)->status (); + bool result = entry->do_ping (poa_.in ()); + LiveStatus status = entry->status (); if (result) { if (status != LS_DEAD) { - if (!want_reping || (*entry)->next_check() < next) + ACE_DEBUG ((LM_DEBUG, "Checking PerClient entry[%d] %x, want_reping = %d next check = %d ms\n", + i++, entry, want_reping, entry->next_check().msec())); + if (!want_reping || entry->next_check() < next) { want_reping = true; - next = (*entry)->next_check(); + next = entry->next_check(); } } + else + { + ACE_DEBUG ((LM_DEBUG, "Removing Per Client entry %x, status = DEAD (%d)\n", entry, status)); + this->per_client_.remove (entry); + } } else { if (status != LS_PING_AWAY && status != LS_TRANSIENT) { - this->per_client_.remove (*entry); + ACE_DEBUG ((LM_DEBUG, "Removing Per Client entry %x, status = %d\n", entry, status)); + this->per_client_.remove (entry); } } } @@ -431,6 +428,7 @@ LiveCheck::remove_server (const char *server) void LiveCheck::remove_per_client_entry (LiveEntry *e) { + ACE_DEBUG ((LM_DEBUG, "Explicitly removing PerClient entry %x\n", e)); this->per_client_.remove (e); } @@ -443,7 +441,9 @@ LiveCheck::add_per_client_listener (LiveListener *l, LiveEntry *entry = 0; ACE_NEW_RETURN (entry, LiveEntry (this, 0, ref), false); - if (this->per_client_.push(entry) == 0) + ACE_DEBUG ((LM_DEBUG, "Adding PerClient entry %x\n", entry)); + + if (this->per_client_.insert_tail(entry) == 0) { entry->add_listener (l); diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h index 5d731a411f6..8b39415e124 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h @@ -14,7 +14,7 @@ #include "tao/ImR_Client/ServerObjectS.h" // ServerObject_AMIS.h -#include "ace/Vector_T.h" +#include "ace/Unbounded_Set.h" #include "ace/Hash_Map_Manager.h" #include "ace/SString.h" #include "ace/Event_Handler.h" @@ -194,7 +194,7 @@ class Locator_Export LiveCheck : public ACE_Event_Handler ACE_Hash, ACE_Equal_To, TAO_SYNCH_MUTEX> LiveEntryMap; - typedef ACE_Unbounded_Stack PerClientStack; + typedef ACE_Unbounded_Set PerClientStack; LiveEntryMap entry_map_; PerClientStack per_client_; -- cgit v1.2.1