diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2013-05-08 20:40:32 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2013-05-08 20:40:32 +0000 |
commit | 7654d530ae53763da700d9e01b147d780c7c83cd (patch) | |
tree | 768712074a30e319999ae725febcb4f43775da75 | |
parent | fbb34b996992b0fbd0a57f01d857e4eacaaef4e0 (diff) | |
download | ATCD-7654d530ae53763da700d9e01b147d780c7c83cd.tar.gz |
Merge from trunk
21 files changed, 443 insertions, 185 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index c157d57a4ff..5e0c110dc36 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,9 +1,23 @@ +Wed May 8 14:56:24 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> + + * tao/Dynamic_TP/DTP_Thread_Pool.cpp: + + Fix typos from hasty commit. + +Wed May 8 14:42:55 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> + + * tao/Dynamic_TP/DTP_Thread_Pool.cpp: + + Fix for the case when the ORB is shutting down and a POA needs to + inform the IMR. + Thu May 2 09:00:38 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> * orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp: * orbsvcs/ImplRepo_Service/XML_Backing_Store.cpp: - Clean up issues related to restarting the locator with persisted info. + Clean up issues related to restarting the locator with persisted + info. Wed May 1 21:06:50 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> diff --git a/TAO/orbsvcs/ImplRepo_Service/Adapter_Activator.cpp b/TAO/orbsvcs/ImplRepo_Service/Adapter_Activator.cpp index 75ee0e4700e..605bfb6a268 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Adapter_Activator.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/Adapter_Activator.cpp @@ -13,7 +13,6 @@ #include "orbsvcs/Log_Macros.h" #include "tao/PortableServer/Servant_Base.h" -#include "tao/PortableServer/Servant_Base.h" ImR_Adapter::ImR_Adapter (void) : default_servant_ (0) diff --git a/TAO/orbsvcs/ImplRepo_Service/Adapter_Activator.h b/TAO/orbsvcs/ImplRepo_Service/Adapter_Activator.h index 72aa6060f15..988b6c97098 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Adapter_Activator.h +++ b/TAO/orbsvcs/ImplRepo_Service/Adapter_Activator.h @@ -27,7 +27,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_ServantBase; TAO_END_VERSIONED_NAMESPACE_DECL - /** * @class ImR_Adapter_Activator * diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp index d22a3c10ed2..4cfe53ee5e4 100644 --- a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp @@ -5,6 +5,8 @@ #include "ImR_Locator_i.h" #include "Locator_Repository.h" +#include "orbsvcs/Log_Macros.h" + //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- @@ -78,6 +80,7 @@ AsyncAccessManager::add_interest (ImR_ResponseHandler *rh) ACE_NEW (l, AsyncLiveListener (this->info_->name.c_str(), this, this->locator_.pinger())); + LiveListener_ptr llp(l); if (!l->start()) { if (!this->send_start_request()) @@ -196,8 +199,6 @@ AsyncAccessManager::server_is_running (const char *partial_ior, this->final_state (); } - // This is not a leak. The listener registers with - // the pinger and will delete itself when done. AsyncLiveListener *l = 0; if (this->info_->activation_mode == ImplementationRepository::PER_CLIENT) { @@ -212,6 +213,8 @@ AsyncAccessManager::server_is_running (const char *partial_ior, this, this->locator_.pinger())); } + + LiveListener_ptr llp(l); if (!l->start()) { this->status (AAM_SERVER_DEAD); @@ -220,6 +223,19 @@ AsyncAccessManager::server_is_running (const char *partial_ior, } void +AsyncAccessManager::notify_child_death (void) +{ + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) AsyncAccessManager, child death\n"))); + } + this->status (AAM_SERVER_DEAD); + this->final_state (); +} + + +void AsyncAccessManager::ping_replied (LiveStatus server) { switch (server) @@ -511,10 +527,9 @@ AsyncLiveListener::~AsyncLiveListener (void) bool AsyncLiveListener::start (void) { - bool rtn = this->per_client_ ? this->pinger_.add_per_client_listener (this,srv_ref_.in()) - : this->pinger_.add_listener (this); - if (!rtn) - delete this; + bool rtn = this->per_client_ ? + this->pinger_.add_per_client_listener (this, srv_ref_.in()) : + this->pinger_.add_listener (this); return rtn; } @@ -529,7 +544,6 @@ AsyncLiveListener::status_changed (LiveStatus status) else { this->aam_->ping_replied (status); - delete this; } return true; } diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h index 358d4efebbd..1cfc0ea33d8 100644 --- a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h +++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h @@ -84,6 +84,7 @@ class AsyncAccessManager void server_is_running (const char *partial_ior, ImplementationRepository::ServerObject_ptr ref); void server_is_shutting_down (void); + void notify_child_death (void); void ping_replied (LiveStatus server); AsyncAccessManager *add_ref (void); diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp index 48fd7af01a6..cee8302f9af 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp @@ -445,16 +445,16 @@ ImR_Locator_i::notify_child_death _tao_rh->notify_child_death (); } -bool -ImR_Locator_i::get_info_for_name (const char* name, Server_Info_Ptr &si) +char* +ImR_Locator_i::activate_server_by_name (const char* name, bool manual_start) { ImR_SyncResponseHandler rh ("", this->orb_.in()); this->activate_server_by_name (name, manual_start, &rh); return rh.wait_for_result (); } -bool -ImR_Locator_i::split_key (ACE_CString &full, ACE_CString &key, Server_Info_Ptr &si) +char* +ImR_Locator_i::activate_server_by_object (const char* object_name) { Server_Info_Ptr si; ACE_CString key; diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_ResponseHandler.h b/TAO/orbsvcs/ImplRepo_Service/ImR_ResponseHandler.h index c9c0fe7b9ff..eb7c28f6492 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_ResponseHandler.h +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_ResponseHandler.h @@ -11,13 +11,12 @@ #ifndef IMR_RESPONSE_HANDLER_H #define IMR_RESPONSE_HANDLER_H +#include "tao/LocalObject.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/LocalObject.h" - //---------------------------------------------------------------------------- /** diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp index 397db0f27ae..76ef51a3ebc 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp @@ -2,19 +2,169 @@ // $Id$ #include "LiveCheck.h" +#include "ImR_Locator_i.h" + +#include "orbsvcs/Log_Macros.h" + #include "tao/ORB_Core.h" #include "ace/Reactor.h" #include "ace/High_Res_Timer.h" LiveListener::LiveListener (const char *server) - : server_(server) + : server_(server), + refcount_(1), + lock_() +{ +} + +LiveListener::~LiveListener (void) { } const char * LiveListener::server (void) const { - return this->server_; + return this->server_.c_str (); +} + +LiveListener * +LiveListener::add_ref (void) +{ + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, 0); + ++this->refcount_; + return this; +} + +void +LiveListener::remove_ref (void) +{ + int count = 0; + { + ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); + count = --this->refcount_; + } + if (count == 0) + { + delete this; + } +} + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- + +LiveListener_ptr::LiveListener_ptr (void) + : val_ (0) +{ +} + +LiveListener_ptr::LiveListener_ptr (LiveListener *ll) + :val_ (ll) +{ +} + +LiveListener_ptr::LiveListener_ptr (const LiveListener_ptr &ll_ptr) + :val_ (ll_ptr.clone()) +{ +} + +LiveListener_ptr::~LiveListener_ptr (void) +{ + if (val_ != 0) + { + val_->remove_ref(); + } +} + +LiveListener_ptr & +LiveListener_ptr::operator= (const LiveListener_ptr &ll_ptr) +{ + if (val_ != *ll_ptr) + { + if (val_ != 0) + { + val_->remove_ref(); + } + val_ = ll_ptr.clone(); + } + return *this; +} + +LiveListener_ptr & +LiveListener_ptr::operator= (LiveListener *ll) +{ + if (val_ != ll) + { + if (val_ != 0) + { + val_->remove_ref(); + } + val_ = ll; + } + return *this; +} + +const LiveListener * +LiveListener_ptr::operator-> () const +{ + return val_; +} + +const LiveListener * +LiveListener_ptr::operator* () const +{ + return val_; +} + +LiveListener * +LiveListener_ptr::operator-> () +{ + return val_; +} + +LiveListener * +LiveListener_ptr::operator* () +{ + return val_; +} + +bool +LiveListener_ptr::operator== (const LiveListener_ptr &ll_ptr) const +{ + return val_ == *ll_ptr; +} + +bool +LiveListener_ptr::operator== (const LiveListener *ll) const +{ + return val_ == ll; +} + +LiveListener * +LiveListener_ptr::clone (void) const +{ + if (val_ != 0) + { + val_->add_ref(); + } + return val_; +} + +LiveListener * +LiveListener_ptr::_retn (void) +{ + LiveListener * ll = val_; + val_ = 0; + return ll; +} + +void +LiveListener_ptr::assign (LiveListener *ll) +{ + if (val_ != 0) + { + val_->remove_ref(); + } + val_ = ll; } //--------------------------------------------------------------------------- @@ -57,15 +207,16 @@ LiveEntry::max_retry_msec (int msec) LiveEntry::LiveEntry (LiveCheck *owner, const char *server, + bool may_ping, ImplementationRepository::ServerObject_ptr ref) : owner_ (owner), server_ (server), ref_ (ImplementationRepository::ServerObject::_duplicate (ref)), liveliness_ (LS_UNKNOWN), next_check_ (ACE_High_Res_Timer::gettimeofday_hr()), - retry_count_ (0), repings_ (0), max_retry_ (LiveEntry::reping_limit_), + may_ping_ (may_ping), listeners_ (), lock_ () { @@ -76,19 +227,21 @@ LiveEntry::~LiveEntry (void) } void -LiveEntry::add_listener (LiveListener* ll) +LiveEntry::add_listener (LiveListener *ll) { ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); - this->listeners_.insert (ll); + LiveListener_ptr llp(ll->add_ref()); + this->listeners_.insert (llp); } void LiveEntry::reset_status (void) { ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); - if ( this->liveliness_ == LS_ALIVE) + if ( this->liveliness_ == LS_ALIVE || this->liveliness_ == LS_LAST_TRANSIENT) { this->liveliness_ = LS_UNKNOWN; + this->repings_ = 0; this->next_check_ = ACE_High_Res_Timer::gettimeofday_hr(); } } @@ -96,6 +249,9 @@ LiveEntry::reset_status (void) LiveStatus LiveEntry::status (void) const { + if (!this->may_ping_) + return LS_ALIVE; + if ( this->liveliness_ == LS_ALIVE && this->owner_->ping_interval() != ACE_Time_Value::zero ) { @@ -109,35 +265,16 @@ LiveEntry::status (void) const } void -LiveEntry::status (LiveStatus l) +LiveEntry::update_listeners (void) { - { - 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(); - } - } Listen_Set remove; - - LiveStatus ls = this->liveliness_; - if (ls == LS_TRANSIENT && ! this->reping_available()) - ls = LS_LAST_TRANSIENT; for (Listen_Set::ITERATOR i(this->listeners_); !i.done(); i.advance ()) { - LiveListener **ll = 0; - i.next (ll); - if (*ll != 0) + if ((*i)->status_changed (this->liveliness_)) { - if ((*ll)->status_changed (this->liveliness_)) - { - remove.insert (*ll); - } + remove.insert (*i); } } @@ -147,17 +284,37 @@ LiveEntry::status (LiveStatus l) !i.done(); i.advance ()) { - LiveListener **ll = 0; - i.next (ll); - if (*ll != 0) - { - this->listeners_.remove (*ll); - } + this->listeners_.remove (*i); } } +} + +void +LiveEntry::status (LiveStatus l) +{ + { + ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); + this->liveliness_ = l; + if (l == LS_ALIVE) + { + ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr()); + this->next_check_ = now + owner_->ping_interval(); + } + if (l == LS_TRANSIENT && !this->reping_available()) + { + this->liveliness_ = LS_LAST_TRANSIENT; + } + } + this->update_listeners (); if (this->listeners_.size() > 0) { + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveEntry::status change, server = %C status = %d\n"), + this->server_.c_str(), this->liveliness_)); + } this->owner_->schedule_ping (this); } else @@ -173,45 +330,101 @@ LiveEntry::next_check (void) const } bool -LiveEntry::do_ping (PortableServer::POA_ptr poa) +LiveEntry::validate_ping (bool &want_reping, ACE_Time_Value& next) { - ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr()); - if (this->liveliness_ == LS_PING_AWAY || this->listeners_.size() == 0) + if (this->liveliness_ == LS_PING_AWAY || + this->liveliness_ == LS_DEAD || + this->listeners_.size () == 0) { + if (ImR_Locator_i::debug () > 5) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, status ") + ACE_TEXT ("= %d, listeners = %d server %C\n"), + this->liveliness_, this->listeners_.size (), + this->server_.c_str())); + } return false; } - - if (this->next_check_ > now || this->liveliness_ == LS_DEAD) + ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr()); + ACE_Time_Value diff = this->next_check_ - now; + long msec = diff.msec(); + if (msec > 0) { - ACE_Time_Value diff = next_check_ - now; + if (!want_reping || this->next_check_ < next) + { + want_reping = true; + next = this->next_check_; + } + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, ") + ACE_TEXT ("status = %d, listeners = %d, ") + ACE_TEXT ("diff = %d,%d, msec = %d ") + ACE_TEXT ("server %C\n"), + this->liveliness_, this->listeners_.size (), + diff.sec(), diff.usec(), msec, + this->server_.c_str())); + } return false; } - switch (this->liveliness_) { case LS_UNKNOWN: break; case LS_ALIVE: case LS_TIMEDOUT: - this->next_check_ = now + owner_->ping_interval(); + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, false); + this->next_check_ = now + owner_->ping_interval(); + } break; case LS_TRANSIENT: + case LS_LAST_TRANSIENT: { int ms = this->next_reping (); if (ms != -1) { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, false); + if (this->liveliness_ == LS_LAST_TRANSIENT) + { + this->liveliness_ = LS_TRANSIENT; + } ACE_Time_Value next (ms / 1000, (ms % 1000) * 1000); this->next_check_ = now + next; } else { + if (this->liveliness_ == LS_TRANSIENT) + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, false); + this->liveliness_ = LS_LAST_TRANSIENT; + } + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, ") + ACE_TEXT ("transient, no more repings, ") + ACE_TEXT ("server %C\n"), + this->server_.c_str())); + } + if (this->listeners_.size() > 0) + { + this->update_listeners (); + } return false; } } break; default:; } + return true; +} +void +LiveEntry::do_ping (PortableServer::POA_ptr poa) +{ 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()); @@ -220,17 +433,13 @@ LiveEntry::do_ping (PortableServer::POA_ptr poa) try { this->ref_->sendc_ping (cb.in()); - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, false); + ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); this->liveliness_ = LS_PING_AWAY; - this->retry_count_++; } catch (CORBA::Exception &) { this->status (LS_DEAD); - this->retry_count_++; } - - return false; } //--------------------------------------------------------------------------- @@ -315,7 +524,7 @@ LiveCheck::~LiveCheck (void) void LiveCheck::init (CORBA::ORB_ptr orb, - const ACE_Time_Value &pi ) + const ACE_Time_Value &pi) { this->ping_interval_ = pi; ACE_Reactor *r = orb->orb_core()->reactor(); @@ -340,9 +549,20 @@ LiveCheck::ping_interval (void) const int LiveCheck::handle_timeout (const ACE_Time_Value &, - const void */*tok*/) -{ - // long token = reinterpret_cast<long>(tok); + const void * tok) +{ +#if (ACE_SIZEOF_VOID_P == 8) + ACE_INT64 token = reinterpret_cast<ACE_INT64>(tok); +#else + ACE_INT32 token = reinterpret_cast<ACE_INT32>(tok); +#endif + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveCheck::handle_timeout(%d), ") + ACE_TEXT ("running = %d\n"), + token, this->running_)); + } if (!this->running_) return -1; @@ -353,19 +573,28 @@ LiveCheck::handle_timeout (const ACE_Time_Value &, le != le_end; ++le) { - if (le->item ()->do_ping (poa_.in ())) + LiveEntry *entry = le->item (); + if (entry->validate_ping (want_reping, next)) { - LiveStatus status = le->item ()->status (); - if (status != LS_DEAD) + entry->do_ping (poa_.in ()); + if (ImR_Locator_i::debug () > 2) { - if (!want_reping || le->item ()->next_check() < next) - { - want_reping = true; - next = le->item ()->next_check(); - } + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveCheck::handle_timeout(%d)") + ACE_TEXT (", ping sent\n"), + token)); + } + } + else + { + if (ImR_Locator_i::debug () > 5) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveCheck::handle_timeout(%d)") + ACE_TEXT (", ping skipped\n"), + token)); } } - } PerClientStack::iterator pe_end = this->per_client_.end(); @@ -376,46 +605,49 @@ LiveCheck::handle_timeout (const ACE_Time_Value &, LiveEntry *entry = *pe; if (entry != 0) { - bool result = entry->do_ping (poa_.in ()); - LiveStatus status = entry->status (); - if (result) + if (entry->validate_ping (want_reping, next)) { - if (status != LS_DEAD) - { - if (!want_reping || entry->next_check() < next) - { - want_reping = true; - next = entry->next_check(); - } - } - else - { - this->per_client_.remove (entry); - } + entry->do_ping (poa_.in ()); } - else + LiveStatus status = entry->status (); + if (status != LS_PING_AWAY && status != LS_TRANSIENT) { - if (status != LS_PING_AWAY && status != LS_TRANSIENT) - { - this->per_client_.remove (entry); - } + this->per_client_.remove (entry); } } } + if (want_reping) { ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr()); ACE_Time_Value delay = next - now; ++this->token_; + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveCheck::handle_timeout(%d),") + ACE_TEXT (" want reping, delay = %d,%d\n"), + token, delay.sec(), delay.usec())); + } this->reactor()->schedule_timer (this, reinterpret_cast<void *>(this->token_), delay); } return 0; } +bool +LiveCheck::has_server (const char *server) +{ + ACE_CString s (server); + LiveEntry *entry = 0; + int result = entry_map_.find (s, entry); + return (result == 0 && entry != 0); +} + void LiveCheck::add_server (const char *server, + bool may_ping, ImplementationRepository::ServerObject_ptr ref) { if (!this->running_) @@ -423,7 +655,7 @@ LiveCheck::add_server (const char *server, ACE_CString s (server); LiveEntry *entry = 0; - ACE_NEW (entry, LiveEntry (this, server, ref)); + ACE_NEW (entry, LiveEntry (this, server, may_ping, ref)); int result = entry_map_.bind (s, entry); if (result != 0) { @@ -457,7 +689,7 @@ LiveCheck::add_per_client_listener (LiveListener *l, return false; LiveEntry *entry = 0; - ACE_NEW_RETURN (entry, LiveEntry (this, 0, ref), false); + ACE_NEW_RETURN (entry, LiveEntry (this, 0, true, ref), false); if (this->per_client_.insert_tail(entry) == 0) { @@ -526,6 +758,14 @@ LiveCheck::schedule_ping (LiveEntry *entry) ++this->token_; if (next <= now) { + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveCheck::Schdedule_ping(%d),") + ACE_TEXT (" immediate\n"), + this->token_)); + } + this->reactor()->schedule_timer (this, reinterpret_cast<void *>(this->token_), ACE_Time_Value::zero); @@ -533,6 +773,13 @@ LiveCheck::schedule_ping (LiveEntry *entry) else { ACE_Time_Value delay = next - now; + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveCheck::Schdedule_ping(%d),") + ACE_TEXT (" delay = %d,%d\n"), + this->token_, delay.sec(), delay.usec())); + } this->reactor()->schedule_timer (this, reinterpret_cast<void *>(this->token_), delay); diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h index b3b643e5363..cc8b060e52b 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h @@ -12,7 +12,7 @@ #include "locator_export.h" -#include "tao/ImR_Client/ServerObjectS.h" // ServerObject_AMIS.h +#include "ServerObjectS.h" // ServerObject_AMIS.h #include "ace/Unbounded_Set.h" #include "ace/Hash_Map_Manager.h" @@ -67,6 +67,8 @@ class Locator_Export LiveListener /// look up a listener entry in the LiveCheck map. LiveListener (const char *server); + virtual ~LiveListener (void); + /// called by the asynch ping receiver when a reply or an exception /// is received. Returns true if finished listening virtual bool status_changed (LiveStatus status) = 0; @@ -74,10 +76,43 @@ class Locator_Export LiveListener /// accessor for the server name. Used by the LiveCheck to associate a listener const char *server (void) const; + LiveListener *add_ref (void); + void remove_ref (void); + private: - const char *server_; + ACE_CString server_; + + int refcount_; + TAO_SYNCH_MUTEX lock_; }; +class LiveListener_ptr +{ +public: + LiveListener_ptr (void); + LiveListener_ptr (LiveListener *aam); + LiveListener_ptr (const LiveListener_ptr &aam_ptr); + ~LiveListener_ptr (void); + + LiveListener_ptr &operator = (const LiveListener_ptr &aam_ptr); + LiveListener_ptr &operator = (LiveListener *aam); + const LiveListener * operator-> () const; + const LiveListener * operator* () const; + LiveListener * operator-> (); + LiveListener * operator* (); + bool operator== (const LiveListener_ptr &aam_ptr) const; + bool operator== (const LiveListener *aam) const; + + LiveListener * clone (void) const; + LiveListener * _retn (void); + + void assign (LiveListener *aam); + +private: + LiveListener * val_; +}; + + //--------------------------------------------------------------------------- /* * @class LiveEntry @@ -94,15 +129,18 @@ class Locator_Export LiveEntry public: LiveEntry (LiveCheck *owner, const char *server, + bool may_ping, ImplementationRepository::ServerObject_ptr ref); ~LiveEntry (void); - void add_listener (LiveListener * ll); + void add_listener (LiveListener *ll); LiveStatus status (void) const; void status (LiveStatus l); void reset_status (void); - bool do_ping (PortableServer::POA_ptr poa); + void update_listeners (void); + bool validate_ping (bool &want_reping, ACE_Time_Value &next); + void 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); @@ -118,8 +156,9 @@ class Locator_Export LiveEntry short retry_count_; int repings_; int max_retry_; + bool may_ping_; - typedef ACE_Unbounded_Set<LiveListener *> Listen_Set; + typedef ACE_Unbounded_Set<LiveListener_ptr> Listen_Set; Listen_Set listeners_; TAO_SYNCH_MUTEX lock_; static const int reping_msec_ []; @@ -168,13 +207,17 @@ class Locator_Export LiveCheck : public ACE_Event_Handler LiveCheck (); ~LiveCheck (void); - void init (CORBA::ORB_ptr orb, const ACE_Time_Value &interval); + void init (CORBA::ORB_ptr orb, + const ACE_Time_Value &interval); void shutdown (void); int handle_timeout (const ACE_Time_Value ¤t_time, const void *act = 0); + bool has_server (const char *server); + void add_server (const char *server, + bool may_ping, ImplementationRepository::ServerObject_ptr ref); void remove_server (const char *server); diff --git a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp index cb56247559d..c9accb70efb 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp @@ -333,7 +333,6 @@ Options::print_usage (void) const ACE_TEXT (" -t secs Server startup timeout.(Default = 60s)\n") ACE_TEXT (" -v msecs Server verification interval.(Default = 10000ms)\n") ACE_TEXT (" -i Ping servers without activators too. (Default=false)\n") - ACE_TEXT (" --asynch Servant dispatching using asynch method handling\n") )); } diff --git a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp index f8516bff457..81d986b2d69 100644 --- a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp @@ -6,7 +6,7 @@ #include "ace/OS_NS_unistd.h" int client_num = 0; -ACE_CString server_ior; +ACE_TCHAR *server_ior = 0; bool expect_transient = false; int diff --git a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl index 867b4662ce1..99925e985c1 100755 --- a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl +++ b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl @@ -98,7 +98,7 @@ for(my $i = 0; $i < $client_count; $i++) { push (@cli, PerlACE::TestTarget::create_target (++$tgt_num)) || die "Create target $tgt_num failed\n"; } -my $refstyle = ""; # "-ORBobjrefstyle URL"; +my $refstyle = "-ORBobjrefstyle URL"; my $obj_count = 1; my $port = $imr->RandomPort(); @@ -133,8 +133,6 @@ my @srvstatusfile; my @srv_statusfile; my @obj; my @srv_server_cmd; -my $debug_log_file = ""; - # Have list indices match server IDs (S1, S2, S3) with first element of list not being used. for(my $i = 0; $i < $servers_count; $i++) { push (@srv, PerlACE::TestTarget::create_target (++$tgt_num)) || die "Create target $tgt_num failed\n"; @@ -187,10 +185,7 @@ sub run_imr_util { sub register_server_with_activator { my $srv_id = shift; my $srv_to_invoke_id = shift; - my $srv_debug_log = ""; - if ($debug_level == 10) { - $srv_debug_log = "test_server_$srv_id" . ".log"; - } + $srv_args = "$debug_arg $srvlogfile[$srv_id] -orbuseimr 1 $refstyle ". "$expect_transient ". diff --git a/TAO/tao/Dynamic_TP/DTP_Thread_Pool.cpp b/TAO/tao/Dynamic_TP/DTP_Thread_Pool.cpp index 597a97b1590..5d273dbd040 100644 --- a/TAO/tao/Dynamic_TP/DTP_Thread_Pool.cpp +++ b/TAO/tao/Dynamic_TP/DTP_Thread_Pool.cpp @@ -136,21 +136,26 @@ TAO_DTP_Thread_Pool::new_dynamic_thread (void) if (TAO_debug_level > 0) { TAOLIB_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) DTP Pool %d new_dynamic_thread, max = %d, current = %d\n"), - this->id_, this->definition_.max_threads_, (int)this->threads_.thr_count ())); + ACE_TEXT ("TAO (%P|%t) DTP Pool %d new_dynamic_thread, ") + ACE_TEXT ("max = %d, current = %d\n"), + this->id_, this->definition_.max_threads_, + (int)this->threads_.thr_count ())); + } + + if (this->manager_.orb_core ().has_shutdown () || this->shutdown_ || + (this->definition_.max_threads_ > 0 && + (int)this->active_count_ >= this->definition_.max_threads_)) + { + return false; } - if (this->definition_.max_threads_ > 0 && - (int)this->active_count_ >= this->definition_.max_threads_) - return false; ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, false); - if (!this->manager_.orb_core ().has_shutdown () && !this->shutdown_ && - (this->definition_.max_threads_ == -1 || - (int)this->active_count_ < this->definition_.max_threads_)) + if (this->definition_.max_threads_ == -1 || + (int)this->active_count_ < this->definition_.max_threads_) { if (TAO_debug_level > 7) TAOLIB_DEBUG ((LM_DEBUG, diff --git a/TAO/tao/IORTable/IORTable.h b/TAO/tao/IORTable/IORTable.h index f29071c3d3f..7bae99afdb1 100644 --- a/TAO/tao/IORTable/IORTable.h +++ b/TAO/tao/IORTable/IORTable.h @@ -40,7 +40,6 @@ TAO_Requires_IORTable_Initializer = TAO_IORTable_Initializer::init (); TAO_END_VERSIONED_NAMESPACE_DECL #define TAO_IORTABLE_SAFE_INCLUDE -#include "tao/IORTable/Locate_ResponseHandler.h" #include "tao/IORTable/IORTableC.h" #undef TAO_IORTABLE_SAFE_INCLUDE diff --git a/TAO/tao/IORTable/IOR_Table_Impl.cpp b/TAO/tao/IORTable/IOR_Table_Impl.cpp index 058c07fb69b..f5c2f649813 100644 --- a/TAO/tao/IORTable/IOR_Table_Impl.cpp +++ b/TAO/tao/IORTable/IOR_Table_Impl.cpp @@ -44,7 +44,6 @@ TAO::Objref_Traits <TAO_IOR_Table_Impl>::marshal (const TAO_IOR_Table_Impl_ptr, } TAO_IOR_Table_Impl::TAO_IOR_Table_Impl (void) - : use_async_(false) { } @@ -70,32 +69,6 @@ TAO_IOR_Table_Impl::find (const char *object_key) } void -TAO_IOR_Table_Impl::async_find (::IORTable::Locate_ResponseHandler handler, - const char *object_key) -{ - // We don't want the lock held during locate, so make it go out - // of scope before then. - { - ACE_CString key (object_key); - ACE_CString ior; - TAO_AMH_Locate_ResponseHandler_var rh = handler; - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - if (this->map_.find (key, ior) == 0) - { - rh->forward_ior (ior.c_str(), false); - return; - } - if (CORBA::is_nil (this->async_locator_.in ())) - { - rh->raise_excep (IORTable::NotFound ()); - return; - } - } - - this->async_locator_->async_locate (handler, object_key); -} - -void TAO_IOR_Table_Impl::bind (const char * object_key, const char * IOR) { ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); @@ -123,8 +96,6 @@ TAO_IOR_Table_Impl::set_locator (IORTable::Locator_ptr locator) { ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); this->locator_ = IORTable::Locator::_duplicate (locator); - this->async_locator_ = IORTable::AsyncLocator::_narrow (locator); - this->use_async_ = !CORBA::is_nil (this->async_locator_.in()); } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/IORTable/IOR_Table_Impl.h b/TAO/tao/IORTable/IOR_Table_Impl.h index 98bbedccc8a..5f52c524b40 100644 --- a/TAO/tao/IORTable/IOR_Table_Impl.h +++ b/TAO/tao/IORTable/IOR_Table_Impl.h @@ -59,9 +59,6 @@ public: /// Find the object, using the locator if it is not on the table. char *find (const char *object_key); - void async_find (::IORTable::Locate_ResponseHandler rh, - const char *object_key); - /** * @name The IORTable::Table methods * @@ -88,8 +85,6 @@ protected: /// The locator IORTable::Locator_var locator_; - IORTable::AsyncLocator_var async_locator_; - bool use_async_; /// Synchronization TAO_SYNCH_MUTEX lock_; diff --git a/TAO/tao/IORTable/Locate_ResponseHandler.cpp b/TAO/tao/IORTable/Locate_ResponseHandler.cpp index cf36cae1ef2..d307539ad06 100644 --- a/TAO/tao/IORTable/Locate_ResponseHandler.cpp +++ b/TAO/tao/IORTable/Locate_ResponseHandler.cpp @@ -52,10 +52,11 @@ TAO_AMH_Locate_ResponseHandler::raise_excep (const CORBA::Exception &ex) } void -TAO_AMH_Locate_ResponseHandler::forward_ior (const char *ior, CORBA::Boolean is_perm) +TAO_AMH_Locate_ResponseHandler::forward_ior (const char *ior, + CORBA::Boolean is_perm) { CORBA::Object_var fwd = this->orb_->string_to_object (ior); - this->_tao_rh_send_location_forward (fwd, is_perm); + this->_tao_rh_send_location_forward (fwd.in(), is_perm); } diff --git a/TAO/tao/IORTable/Locate_ResponseHandler.h b/TAO/tao/IORTable/Locate_ResponseHandler.h index 8354e053cb2..fd66832b9d2 100644 --- a/TAO/tao/IORTable/Locate_ResponseHandler.h +++ b/TAO/tao/IORTable/Locate_ResponseHandler.h @@ -23,7 +23,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "iortable_export.h" +#include "async_iortable_export.h" #include "tao/Versioned_Namespace.h" #include "tao/Messaging/AMH_Response_Handler.h" #include "tao/Valuetype/ValueBase.h" @@ -48,7 +48,7 @@ typedef TAO_AMH_Locate_ResponseHandler *TAO_AMH_Locate_ResponseHandler_ptr; * As any other pseudo object, this class has a T_var class too. * */ -class TAO_IORTable_Export TAO_AMH_Locate_ResponseHandler_var +class TAO_Async_IORTable_Export TAO_AMH_Locate_ResponseHandler_var { public: TAO_AMH_Locate_ResponseHandler_var (void); @@ -98,7 +98,7 @@ private: * representing the interface and the implementation. * */ -class TAO_IORTable_Export TAO_AMH_Locate_ResponseHandler +class TAO_Async_IORTable_Export TAO_AMH_Locate_ResponseHandler : public virtual TAO_AMH_Response_Handler { public: diff --git a/TAO/tao/IORTable/Table_Adapter.cpp b/TAO/tao/IORTable/Table_Adapter.cpp index d67940fc662..c6ecb418486 100644 --- a/TAO/tao/IORTable/Table_Adapter.cpp +++ b/TAO/tao/IORTable/Table_Adapter.cpp @@ -94,15 +94,6 @@ TAO_Table_Adapter::dispatch (TAO::ObjectKey &key, rootref = this->root_; } - if (this->root_->async_available ()) - { - // construct a callback handler - TAO_AMH_Locate_ResponseHandler_var rh; - ACE_NEW_RETURN (rh, TAO_AMH_Locate_ResponseHandler (request), DS_MISMATCHED_KEY); - this->find_object (rh, key); - return 0; - } - if (this->find_object (key, forward_to)) { request.forward_location (forward_to); @@ -199,16 +190,6 @@ TAO_Table_Adapter::find_object (TAO::ObjectKey &key, return true; } - -void -TAO_Table_Adapter::find_object (IORTable::Locate_ResponseHandler rh, - TAO::ObjectKey &key) -{ - CORBA::String_var object_key; - TAO::ObjectKey::encode_sequence_to_string (object_key.out (), key); - root_->async_find (rh, object_key.in ()); -} - // **************************************************************** TAO_Table_Adapter_Factory::TAO_Table_Adapter_Factory (void) diff --git a/TAO/tao/IORTable/Table_Adapter.h b/TAO/tao/IORTable/Table_Adapter.h index 4802e1ba710..1d5965f951e 100644 --- a/TAO/tao/IORTable/Table_Adapter.h +++ b/TAO/tao/IORTable/Table_Adapter.h @@ -65,10 +65,6 @@ protected: bool find_object (TAO::ObjectKey &key, CORBA::Object_out forward_to); - void find_object (::IORTable::Locate_ResponseHandler rh, - TAO::ObjectKey &key); - - /// The ORB Core we belong to TAO_ORB_Core &orb_core_; diff --git a/TAO/tao/ImR_Client/ImR_Client.mpc b/TAO/tao/ImR_Client/ImR_Client.mpc index 45e933b2d0f..adeaf26911e 100644 --- a/TAO/tao/ImR_Client/ImR_Client.mpc +++ b/TAO/tao/ImR_Client/ImR_Client.mpc @@ -26,7 +26,7 @@ project(*idl) : tao_versioning_idl_defaults, install { } } -project(ImR_Client) : taolib, tao_output, install, portableserver, taoidldefaults, iormanip, valuetype, messaging { +project(ImR_Client) : taolib, tao_output, install, portableserver, taoidldefaults, iormanip { after += *idl sharedname = TAO_ImR_Client dynamicflags += TAO_IMR_CLIENT_BUILD_DLL |