diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2013-03-25 17:39:40 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2013-03-25 17:39:40 +0000 |
commit | a7661237abaf5f1f66c33511e2b84d98c68a34f2 (patch) | |
tree | f3c56c1b9a7b3c704372e9614590eef22d9f9a57 | |
parent | 814dc56c6c628b988a01546df3cb8bfdf6e31041 (diff) | |
download | ATCD-a7661237abaf5f1f66c33511e2b84d98c68a34f2.tar.gz |
Mon Mar 25 17:35:24 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r-- | TAO/ChangeLog_Asynch_ImR | 21 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp | 100 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h | 135 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp | 36 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/Forwarder.h | 56 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp | 11 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp | 105 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h | 41 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp | 21 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/LiveCheck.h | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp | 6 |
12 files changed, 488 insertions, 62 deletions
diff --git a/TAO/ChangeLog_Asynch_ImR b/TAO/ChangeLog_Asynch_ImR index c9dee4c7123..fadb7b5cb9d 100644 --- a/TAO/ChangeLog_Asynch_ImR +++ b/TAO/ChangeLog_Asynch_ImR @@ -1,3 +1,24 @@ +Mon Mar 25 17:35:24 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> + + * orbsvcs/ImplRepo_Service/AsyncAccessManager.h: + * orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp: + * orbsvcs/ImplRepo_Service/Forwarder.h: + * orbsvcs/ImplRepo_Service/Forwarder.cpp: + * orbsvcs/ImplRepo_Service/INS_Locator.cpp: + * orbsvcs/ImplRepo_Service/ImR_Locator_i.h: + * orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp: + * orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc: + * orbsvcs/ImplRepo_Service/LiveCheck.h: + * orbsvcs/ImplRepo_Service/LiveCheck.cpp: + * orbsvcs/ImplRepo_Service/Locator_Options.cpp: + + Continue with implementation. Added some temporary debug output, hooked up the + sync version of the reactive ping-wait. Started in on the next stage, which is + making the rest of the server access Asynchronous. Changed the mode select flag + for start up from defaulting to the traditional sync-style of calls to the new + asynch style. The temporary command line flag is now --old, to use the old + style for comparison. + Fri Mar 22 18:16:00 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> * orbsvcs/ImplRepo_Service/LiveCheck.cpp: diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp new file mode 100644 index 00000000000..cc09a4d0687 --- /dev/null +++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp @@ -0,0 +1,100 @@ +// -*- C++ -*- +// $Id$ + +#include "AsyncAccessManager.h" +#include "ImR_Locator_i.h" + + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- + +#if 0 +class AsyncAccessManager +{ + public: + AsyncAccessManager (UpdateableServerInfo &info, ImR_Locator_i &locator); + ~AsyncAccessManager (void); + + void add_interest (ImR_ReplyHandler *rh); + AAM_Status status (void) const; + + void activator_replied (void); + void server_is_running (void); + void ping_replied (bool is_alive); + void + + void add_ref (void); + void remove_ref (void); + + private: + UpdateableServerInfo &info_; + ImR_Locator_i &locator_; + + ACE_Stack<ImR_ReplyHandler *> rh_list_; + + AAM_Status status_; + + int refcount_; + TAO_SYNCH_MUTEX lock_; + +}; +#endif + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- + +ImR_Loc_ReplyHandler::ImR_Loc_ReplyHandler (AMH_ImplementationRepository::LocatorResponseHandler_ptr rh) + :rh_ (AMH_ImplementationRepository::LocatorResponseHandler::_duplicate(rh)) +{ +} + +ImR_Loc_ReplyHandler::~ImR_Loc_ReplyHandler (void) +{ +} + +void +ImR_Loc_ReplyHandler::send_ior (const char *) +{ + rh_->activate_server (); // void return + delete this; + +} + +void +ImR_Loc_ReplyHandler::send_exception (void) +{ + CORBA::TRANSIENT ex (CORBA::SystemException::_tao_minor_code + ( TAO_IMPLREPO_MINOR_CODE, 0), + CORBA::COMPLETED_NO); + TAO_AMH_DSI_Exception_Holder h(&ex); + resp_->invoke_excep(&h); + delete this; +} + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- + +AsyncLiveListener::AsyncLiveListener (AsyncAccessManager &aam, LiveCheck &pinger) + :aam_ (aam), + pinger_ (pinger), + status_ (LS_UNKNOWN), + retries_ (10) +{ + this->aam_.add_ref (); + this->pinger_.add_listener (this); +} + +AsyncLiveListener::~AsyncLiveListener (void) +{ + this->aam_.remove_ref (); +} + +void +AsyncLiveListener::status_changed (LiveStatus status) +{ + this->status_ = status; + if (status == LS_TRANSIENT && --this->retries_ > 0) + this->pinger_.add_listener (this); + else + this->aam_.ping_replied (status != LS_DEAD); +} diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h new file mode 100644 index 00000000000..2fa92ad6c0e --- /dev/null +++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h @@ -0,0 +1,135 @@ +// -*- C++ -*- +/* + * @file AsyncAccessManager.h + * + * $Id$ + * + * @author Phil Mesnier <mesnier_p@ociweb.com> + */ + +#ifndef IMR_ASYNCACCESSMANAGER_H_ +#define IMR_ASYNCACCESSMANAGER_H_ + +#include "locator_export.h" + +#include "tao/ImR_Client/ServerObjectS.h" // ServerObject_AMIS.h + +#include "ace/Vector_T.h" +#include "ace/SString.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "LiveCheck.h" + +class ImR_Locator_i; +class ImR_ReplyHandler; +class UpdateableServerInfo; + +//---------------------------------------------------------------------------- +/* + * @class AsyncAccessManager + * + * @brief manages the state of a request for a server across multiple upcalls + * + * When a client implicitly or explicitly requests a server reference up to + * three distinct actions must occur, each of which involves waiting for + * externally triggered events. + * 1) if not running, request activation of the server + * 2) if activated, wait for server to call in with a ServerObject reference + * 3) if not recently pinged, ping the ServerObject to confirm it is alive. + * + * A single AsyncAccessManager instance is used to track the progress of + * an individual server activation. If multiple clients request the same + * server instance, then each can be notified when the server is ready. If + * a server is configured for per-client activation, each client request + * will have its own AAM instance. + */ + +enum AAM_Status + { + AAM_INIT, + AAM_ACTIVATION_SENT, + AAM_WAIT_FOR_RUNNING, + AAM_WAIT_FOR_PING, + AAM_SERVER_READY, + AAM_SERVER_DEAD + }; + +class AsyncAccessManager +{ + public: + AsyncAccessManager (UpdateableServerInfo &info, ImR_Locator_i &locator); + ~AsyncAccessManager (void); + + void add_interest (ImR_ReplyHandler *rh); + AAM_Status status (void) const; + + void activator_replied (void); + void server_is_running (void); + void ping_replied (bool is_alive); + + void add_ref (void); + void remove_ref (void); + + private: + UpdateableServerInfo &info_; + ImR_Locator_i &locator_; + + ACE_Vector<ImR_ReplyHandler *> rh_list_; + + AAM_Status status_; + + int refcount_; + TAO_SYNCH_MUTEX lock_; + +}; + +//---------------------------------------------------------------------------- +/* + * @class ImR_Loc_ReplyHandler + * + * @brief specialized reply handler for Locator interface calls which have a + * void return. + */ + +class ImR_Loc_ReplyHandler : public ImR_ReplyHandler +{ +public: + ImR_Loc_ReplyHandler (ImplementationRepository::AMH_LocatorResponseHandler_ptr rh); + virtual ~ImR_Loc_ReplyHandler (void); + + virtual void send_ior (const char *pior); + virtual void send_exception (void); + +private: + ImplementationRepository::AMH_LocatorResponseHandler_var rh_; + +}; + + +//---------------------------------------------------------------------------- +/* + */ + +class AsyncLiveListener : public LiveListener +{ + public: + AsyncLiveListener (AsyncAccessManager &aam, LiveCheck *pinger); + ~AsyncLiveListener (void); + + void status_changed (LiveStatus status); + + private: + AsyncAccessManager &aam_; + LiveCheck *pinger_; + LiveStatus status_; + int retries_; +}; + + + + + +#endif /* IMR_ASYNCACCESSMANGER_H_ */ diff --git a/TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp b/TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp index 8819ca4bfd3..0be828d5e71 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp @@ -286,13 +286,12 @@ ImR_DSI_Forwarder::invoke (CORBA::ServerRequest_ptr request, TAO::Portable_Server::POA_Current_Impl* impl = tao_current->implementation (); TAO::ObjectKey::encode_sequence_to_string (key_str.out (), impl->object_key ()); - ImR_ReplyHandler * rh = new ImR_ReplyHandler(key_str.in(), - this->locator_.debug() > 0 ? - server_name.in() : "", - this->orb_, resp); - CORBA::String_var pior = this->locator_.activate_server_by_name (server_name.in(), false); - - rh->send_ior (pior.in()); + ImR_DSI_ReplyHandler * rh = 0; + ACE_NEW (rh, ImR_DSI_ReplyHandler(key_str.in(), + this->locator_.debug() > 0 ? + server_name.in() : "", + this->orb_, resp)); + this->locator_.activate_server_by_name (server_name.in(), false, rh); } void @@ -310,11 +309,20 @@ ImR_DSI_Forwarder::invoke_primary_interface(CORBA::ServerRequest_ptr ) //-------------------------------------------------------------------- +ImR_ReplyHandler::ImR_ReplyHandler () +{ +} + +ImR_ReplyHandler::~ImR_ReplyHandler (void) +{ +} + +//-------------------------------------------------------------------- -ImR_ReplyHandler::ImR_ReplyHandler (const char *key, - const char *server_name, - CORBA::ORB_ptr orb, - TAO_AMH_DSI_Response_Handler_ptr resp) +ImR_DSI_ReplyHandler::ImR_DSI_ReplyHandler (const char *key, + const char *server_name, + CORBA::ORB_ptr orb, + TAO_AMH_DSI_Response_Handler_ptr resp) :key_str_ (key), server_name_ (server_name), orb_(CORBA::ORB::_duplicate (orb)), @@ -322,12 +330,12 @@ ImR_ReplyHandler::ImR_ReplyHandler (const char *key, { } -ImR_ReplyHandler::~ImR_ReplyHandler (void) +ImR_DSI_ReplyHandler::~ImR_DSI_ReplyHandler (void) { } void -ImR_ReplyHandler::send_ior (const char *pior) +ImR_DSI_ReplyHandler::send_ior (const char *pior) { ACE_CString ior = pior; @@ -383,7 +391,7 @@ ImR_ReplyHandler::send_ior (const char *pior) } void -ImR_ReplyHandler::send_exception (void) +ImR_DSI_ReplyHandler::send_exception (void) { CORBA::TRANSIENT ex (CORBA::SystemException::_tao_minor_code ( TAO_IMPLREPO_MINOR_CODE, 0), diff --git a/TAO/orbsvcs/ImplRepo_Service/Forwarder.h b/TAO/orbsvcs/ImplRepo_Service/Forwarder.h index 631330f6c55..23932226962 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Forwarder.h +++ b/TAO/orbsvcs/ImplRepo_Service/Forwarder.h @@ -30,6 +30,7 @@ class ImR_Locator_i; +//--------------------------------------------------------------------------- /** * @class ImR_Forwarder: * @@ -73,20 +74,51 @@ private: CORBA::ORB_ptr orb_; }; + +//--------------------------------------------------------------------------- +/** + * @class ImR_ReplyHandler + * + * @brief interface serving as the basis for different strategies of activating + * servers on demand + * + */ + +class ImR_ReplyHandler +{ +public: + ImR_ReplyHandler (void); + virtual ~ImR_ReplyHandler (void); + + virtual void send_ior (const char *pior) = 0; + virtual void send_exception (void) = 0; +}; + +//---------------------------------------------------------------------------- +/** + * @class ImR_DSI_ReplyHandler + * + * @brief specialized reply handler for forward requests that need to send an + * ior + * + * Used to send either a Location_Forward exception, or some other error + * exception. + */ + // forward declare the types used to manage AMH/DSI coupling class TAO_AMH_DSI_Response_Handler; typedef TAO_AMH_DSI_Response_Handler * TAO_AMH_DSI_Response_Handler_ptr; class TAO_AMH_DSI_Response_Handler_var; -class ImR_ReplyHandler +class ImR_DSI_ReplyHandler : public ImR_ReplyHandler { public: - ImR_ReplyHandler (const char *key, - const char *server_name, - CORBA::ORB_ptr orb, - TAO_AMH_DSI_Response_Handler_ptr resp); + ImR_DSI_ReplyHandler (const char *key, + const char *server_name, + CORBA::ORB_ptr orb, + TAO_AMH_DSI_Response_Handler_ptr resp); - ~ImR_ReplyHandler (void); + ~ImR_DSI_ReplyHandler (void); void send_ior (const char *pior); void send_exception (void); @@ -98,6 +130,18 @@ private: TAO_AMH_DSI_Response_Handler_var resp_; }; + +//--------------------------------------------------------------------------- +/** + * @class ImR_Forwarder: + * + * @brief Implementation Repository Forwarder for AMH + * + * This class provides a Default servant implementation that is used to handle + * arbitrary calls and forward them to the correct place. Combinds DSI with + * AMH to ensure the handling thread is never blocked waiting for an upcall + * if one is necessary + */ class ImR_DSI_Forwarder : public virtual TAO_DynamicImplementation { public: diff --git a/TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp b/TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp index 45dba296075..58562921a10 100644 --- a/TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp @@ -33,7 +33,9 @@ INS_Locator::locate (const char* object_key) } if (imr_locator_.debug () > 1) - ACE_DEBUG ((LM_DEBUG, "ImR: Activating server <%s>.\n", key.c_str ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ImR: Activating server <%s>.\n"), + key.c_str ())); CORBA::String_var located = this->imr_locator_.activate_server_by_object (key.c_str ()); @@ -42,7 +44,9 @@ INS_Locator::locate (const char* object_key) tmp += object_key; if (imr_locator_.debug () > 0) - ACE_DEBUG ((LM_DEBUG, "ImR: Forwarding invocation on <%s> to <%s>\n", key.c_str (), tmp.c_str())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ImR: Forwarding invocation on <%s> to <%s>\n"), + key.c_str (), tmp.c_str())); return CORBA::string_dup (tmp.c_str ()); } @@ -124,8 +128,7 @@ INS_Locator::locate (const char* object_key) } // while() // No match is found - throw CORBA::TRANSIENT ( - CORBA::SystemException::_tao_minor_code ( + throw CORBA::TRANSIENT (CORBA::SystemException::_tao_minor_code ( TAO_IMPLREPO_MINOR_CODE, 0), CORBA::COMPLETED_NO); diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp index dc43da3a662..7419e598256 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp @@ -62,6 +62,7 @@ ImR_Locator_i::ImR_Locator_i (void) , debug_ (0) , read_only_ (false) , unregister_if_address_reused_ (false) + , use_asynch_ (true) { // Visual C++ 6.0 is not smart enough to do a direct assignment // while allocating the INS_Locator. So, we have to do it in @@ -98,12 +99,14 @@ ImR_Locator_i::init_with_orb (CORBA::ORB_ptr orb, Options& opts) if (opts.use_asynch()) { + this->use_asynch_ = true; this->dsi_forwarder_.init (orb); this->adapter_.init (& this->dsi_forwarder_); - this->pinger_.init (orb,ping_interval_); + this->pinger_.init (orb, ping_interval_); } else { + this->use_asynch_ = true; this->forwarder_.init (orb); this->adapter_.init (& this->forwarder_); } @@ -450,7 +453,35 @@ ImR_Locator_i::activate_server_by_name (const char* name, bool manual_start) //MDM info.edit()->start_count = 0; - return activate_server_i (info, manual_start); + return this->activate_server_i (info, manual_start); +} + +void +ImR_Locator_i::activate_server_by_name (const char* name, bool manual_start, + ImR_ReplyHandler *rh) +{ + // Activate the server, starting it if necessary. Don't start MANUAL + // servers unless manual_start=true + ACE_ASSERT (name != 0); + + ACE_CString serverKey; + ACE_CString server_id; + bool jacorb_server = false; + this->parse_id(name, server_id, serverKey, jacorb_server); + UpdateableServerInfo info(this->repository_.get(), serverKey); + if (info.null ()) + { + ACE_ERROR (( + LM_ERROR, + ACE_TEXT ("ImR: Cannot find info for server <%C>\n"), + name)); + throw ImplementationRepository::NotFound (); + } + + //MDM + info.edit()->start_count = 0; + + this->activate_server_i (info, manual_start, rh); } char* @@ -480,6 +511,29 @@ ImR_Locator_i::activate_server_by_object (const char* object_name) } } + +void +ImR_Locator_i::activate_server_i (UpdateableServerInfo& info, + bool manual_start, + ImR_ReplyHandler *rh) +{ + if (info->activation_mode == ImplementationRepository::PER_CLIENT) + { + activate_perclient_server_i (info, manual_start,rh); + return; + } + + try + { + CORBA::String_var ior = this->activate_server_i (info, manual_start); + rh->send_ior (ior.in()); + } + catch (CORBA::Exception &) + { + rh->send_exception (); + } +} + char* ImR_Locator_i::activate_server_i (UpdateableServerInfo& info, bool manual_start) @@ -491,7 +545,7 @@ ImR_Locator_i::activate_server_i (UpdateableServerInfo& info, while (true) { - if (is_alive (info)) + if (this->is_alive (info)) { if (debug_ > 1) { @@ -530,6 +584,22 @@ ImR_Locator_i::activate_server_i (UpdateableServerInfo& info, } } +void +ImR_Locator_i::activate_perclient_server_i (UpdateableServerInfo& info, + bool manual_start, + ImR_ReplyHandler *rh) +{ + try + { + CORBA::String_var ior = this->activate_perclient_server_i (info, manual_start); + rh->send_ior (ior.in()); + } + catch (CORBA::Exception &) + { + rh->send_exception (); + } +} + char* ImR_Locator_i::activate_perclient_server_i (UpdateableServerInfo& shared_info, bool manual_start) @@ -551,7 +621,7 @@ ImR_Locator_i::activate_perclient_server_i (UpdateableServerInfo& shared_info, info.edit ()->partial_ior = si->partial_ior.in (); info.edit ()->ior = si->ior.in (); - if (is_alive (info)) + if (this->is_alive (info)) { if (debug_ > 1) { @@ -1065,7 +1135,7 @@ ImR_Locator_i::server_is_running (const char* id, ImplementationRepository::ServerObject_var s = ImplementationRepository::ServerObject::_narrow (obj.in()); - this->pinger_.add_server (server_id.c_str(), s); + this->pinger_.add_server (name.c_str(), s); UpdateableServerInfo info(this->repository_.get(), name); if (info.null ()) @@ -1230,7 +1300,7 @@ ImR_Locator_i::list (CORBA::ULong how_many, if (determine_active_status) { UpdateableServerInfo updatable_info (info); - if (this->is_alive(updatable_info)) + if (this->is_alive (updatable_info)) { imr_info->activeStatus = ImplementationRepository::ACTIVE_YES; } @@ -1424,6 +1494,15 @@ ImR_Locator_i::connect_server (UpdateableServerInfo& info) bool ImR_Locator_i::is_alive (UpdateableServerInfo& info) { + if (this->use_asynch_) + { + this->connect_server (info); + SyncListener listener (info->name.c_str(), + this->orb_.in(), + this->pinger_); + return listener.is_alive(); + } + const size_t table_size = sizeof (PING_RETRY_SCHEDULE) / sizeof (*PING_RETRY_SCHEDULE); @@ -1656,10 +1735,11 @@ ImR_Locator_i::debug () const return debug_; } +//------------------------------------------------------------------------- SyncListener::SyncListener (const char *server, CORBA::ORB_ptr orb, - LiveCheck *pinger) + LiveCheck &pinger) :LiveListener (server), orb_ (CORBA::ORB::_duplicate (orb)), pinger_ (pinger), @@ -1673,17 +1753,21 @@ bool SyncListener::is_alive (void) { - this->status_ = this->pinger_->is_alive(this->server().c_str()); + this->status_ = this->pinger_.is_alive(this->server().c_str()); if (this->status_ == LS_ALIVE) return true; + else if (this->status_ == LS_DEAD) + return false; - this->pinger_->add_listener (this); + int count = this->retries_; + this->pinger_.add_listener (this); while (!this->got_it_) { ACE_Time_Value delay (1,0); this->orb_->perform_work (delay); - this->pinger_->add_listener (this); + if (count != this->retries_) + this->pinger_.add_listener (this); } this->got_it_ = false; this->retries_ = 10; @@ -1695,5 +1779,6 @@ SyncListener::status_changed (LiveStatus status) { this->status_ = status; this->got_it_ = (status != LS_TRANSIENT) || (--this->retries_ == 0); + ACE_DEBUG ((LM_DEBUG, "SynchLisener::status_changed, got it = %d, status = %d\n", got_it_, status)); } diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h index f2dd9564848..ff154a0781d 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h @@ -20,6 +20,7 @@ #include "ImR_LocatorS.h" #include "AsyncStartupWaiterS.h" #include "LiveCheck.h" +//#include "AsyncAccessManager.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -37,8 +38,7 @@ class UpdateableServerInfo; /// requests an activator to take care of activating the /// corresponding server and raises a forward exception to the /// client pointing to the correct server. -class Locator_Export ImR_Locator_i - : public virtual POA_ImplementationRepository::Locator +class ImR_Locator_i : public virtual POA_ImplementationRepository::Locator { public: ImR_Locator_i(); @@ -75,13 +75,12 @@ public: virtual void activate_server (const char * name); virtual void add_or_update_server (const char * name, - const ImplementationRepository::StartupOptions &options); + const ImplementationRepository::StartupOptions &options); virtual void remove_server (const char * name); virtual void shutdown_server (const char * name); virtual void find (const char * name, - ImplementationRepository::ServerInformation_out info); - virtual void list ( - CORBA::ULong how_many, + ImplementationRepository::ServerInformation_out info); + virtual void list (CORBA::ULong how_many, CORBA::Boolean determine_active_status, ImplementationRepository::ServerInformationList_out server_list, ImplementationRepository::ServerInformationIterator_out server_iterator); @@ -90,23 +89,33 @@ public: // Server->Locator virtual void server_is_running (const char* name, - const char* partial_ior, - ImplementationRepository::ServerObject_ptr server_object); + const char* partial_ior, + ImplementationRepository::ServerObject_ptr server_object); virtual void server_is_shutting_down (const char * name); // Used by the INS_Locator to start a sever given an object name char* activate_server_by_object (const char* object_name); - char* activate_server_by_name (const char * name, bool manual_start); + void activate_server_by_name (const char * name, + bool manual_start, + ImR_ReplyHandler *rh); private: char* activate_server_i (UpdateableServerInfo& info, bool manual_start); + void activate_server_i (UpdateableServerInfo& info, + bool manual_start, + ImR_ReplyHandler *rh); + char* activate_perclient_server_i (UpdateableServerInfo& info, bool manual_start); + void activate_perclient_server_i (UpdateableServerInfo& info, + bool manual_start, + ImR_ReplyHandler *rh); + ImplementationRepository::StartupInfo* start_server(UpdateableServerInfo& info, bool manual_start, @@ -162,12 +171,17 @@ private: ACE_Time_Value startup_timeout_; ACE_Time_Value ping_interval_; bool unregister_if_address_reused_; + bool use_asynch_; }; -class Locator_Export SyncListener : public LiveListener +//---------------------------------------------------------------------------- +/* + */ + +class SyncListener : public LiveListener { public: - SyncListener (const char *server, CORBA::ORB_ptr orb, LiveCheck *pinger); + SyncListener (const char *server, CORBA::ORB_ptr orb, LiveCheck &pinger); bool is_alive (void); @@ -175,15 +189,12 @@ class Locator_Export SyncListener : public LiveListener private: CORBA::ORB_var orb_; - LiveCheck *pinger_; + LiveCheck &pinger_; LiveStatus status_; bool got_it_; int retries_; - }; - - #include /**/ "ace/post.h" #endif /* IMR_LOCATOR_I_H */ diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc index 95616644e5a..d553232971f 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc +++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc @@ -75,9 +75,10 @@ project(ImR_Locator) : orbsvcslib, orbsvcs_output, conv_lib, avoids_minimum_corb Source_Files { Activator_Info.cpp Adapter_Activator.cpp + AsyncStartupWaiter_i.cpp +// AsyncAccessManager.cpp Forwarder.cpp ImR_Locator_i.cpp - AsyncStartupWaiter_i.cpp INS_Locator.cpp LiveCheck.cpp Locator_XMLHandler.cpp diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp index 5d31a3c7395..89747d2795d 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp @@ -72,18 +72,30 @@ LiveEntry::status (LiveStatus l) ACE_Time_Value now (ACE_OS::time()); this->next_check_ = now + owner_->ping_interval(); } +#if 0 for (ACE_Vector_Iterator<LiveListener *> i (this->listeners_); !i.done(); i.advance()) { - LiveListener *item = 0; - LiveListener **ll = &item; + LiveListener **ll = 0; i.next(ll); - if (item != 0) + if (*ll != 0) { - item->status_changed (this->liveliness_); + (*ll)->status_changed (this->liveliness_); } } +#else + ACE_DEBUG ((LM_DEBUG,"LiveEntry::status, listeners.size = %d\n", + listeners_.size())); + for (size_t i = 0; i < this->listeners_.size(); i++) + { + LiveListener *ll = this->listeners_[i]; + if (ll != 0) + { + (ll)->status_changed (this->liveliness_); + } + } +#endif this->listeners_.clear(); } @@ -147,6 +159,7 @@ PingReceiver::~PingReceiver (void) void PingReceiver::ping (void) { + ACE_DEBUG ((LM_DEBUG,"ping received\n")); this->entry_->status (LS_ALIVE); PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); poa_->deactivate_object (oid.in()); diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h index 1170a056c03..028dd61e430 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h @@ -25,7 +25,8 @@ class LiveCheck; -/*--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +/* * @enum LiveStatus * * @brief indication of the known condition of a target server @@ -44,7 +45,8 @@ enum LiveStatus { LS_TIMEDOUT }; -/*--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +/* * @class LiveListener * * @brief An interface for receiving asynch liveness status updates @@ -74,7 +76,8 @@ class Locator_Export LiveListener ACE_CString server_; }; -/*--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +/* * @class LiveEntry * * @brief Contains a list of interested listeners for a server @@ -107,7 +110,8 @@ class Locator_Export LiveEntry TAO_SYNCH_MUTEX lock_; }; -/*--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +/* * @class PingReceiver * * @brief callback handler for asynch ping requests @@ -130,7 +134,8 @@ class Locator_Export PingReceiver : LiveEntry * entry_; }; -/*--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- +/* * @class LiveCheck * * @brief The manager class used for pinging servers as needed. diff --git a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp index 6d8f925a049..5cd9a7ab9e5 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp @@ -35,7 +35,7 @@ Options::Options () , service_command_ (SC_NONE) , unregister_if_address_reused_ (false) , imr_type_ (STANDALONE_IMR) -, use_asynch_ (false) +, use_asynch_ (true) { } @@ -237,9 +237,9 @@ Options::parse_args (int &argc, ACE_TCHAR *argv[]) ACE_Time_Value (0, 1000 * ACE_OS::atoi (shifter.get_current ())); } else if (ACE_OS::strcasecmp (shifter.get_current (), - ACE_TEXT ("--asynch")) == 0) + ACE_TEXT ("--old")) == 0) { - this->use_asynch_ = true; + this->use_asynch_ = false; } else { |