From c78d2152fcb525f200d8be5ca74a379264e58bfc Mon Sep 17 00:00:00 2001 From: bala Date: Wed, 8 May 2002 03:35:15 +0000 Subject: *** empty log message *** --- TAO/tao/CORBALOC_Parser.cpp | 11 ++++--- TAO/tao/Invocation.cpp | 3 +- TAO/tao/ORB.cpp | 12 +++++--- TAO/tao/ORB_Core.cpp | 64 ++++++++++++++------------------------- TAO/tao/ORB_Core.h | 6 +--- TAO/tao/ORB_Core.i | 6 ---- TAO/tao/Object.cpp | 57 +++++++++++++++++----------------- TAO/tao/Thread_Lane_Resources.cpp | 62 ++++++++++++++++++++++++++++++++++++- TAO/tao/Thread_Lane_Resources.h | 11 +++++++ TAO/tao/corbafwd.h | 5 +-- 10 files changed, 145 insertions(+), 92 deletions(-) diff --git a/TAO/tao/CORBALOC_Parser.cpp b/TAO/tao/CORBALOC_Parser.cpp index 1a0092b2f35..639d2965487 100644 --- a/TAO/tao/CORBALOC_Parser.cpp +++ b/TAO/tao/CORBALOC_Parser.cpp @@ -256,11 +256,14 @@ TAO_CORBALOC_Parser::parse_string_mprofile_helper ( { TAO_MProfile jth_mprofile; + TAO_Connector_Registry *conn_reg = + orb->orb_core ()->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + int retv = - orb->orb_core ()->connector_registry ()->make_mprofile ( - end_point, - jth_mprofile - ACE_ENV_ARG_PARAMETER); + conn_reg->make_mprofile (end_point, + jth_mprofile + ACE_ENV_ARG_PARAMETER); ACE_CHECK; if (retv != 0) diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp index c50798a60aa..a41f8fd538e 100644 --- a/TAO/tao/Invocation.cpp +++ b/TAO/tao/Invocation.cpp @@ -236,7 +236,8 @@ TAO_GIOP_Invocation::perform_call (TAO_Transport_Descriptor_Interface &desc // Get a pointer to the connector registry, which might be in // thread-specific storage, depending on the concurrency model. TAO_Connector_Registry *conn_reg = - this->orb_core_->connector_registry (); + this->orb_core_->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); if (conn_reg == 0) { diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 909c3e02a9f..50c8bdbb2f8 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -1862,12 +1862,14 @@ CORBA_ORB::url_ior_string_to_object (const char* str // of profiles and tell the MProfile object to allocate enough memory // to hold them all. - int retv = - this->orb_core_->connector_registry ()->make_mprofile ( - str, - mprofile - ACE_ENV_ARG_PARAMETER); + TAO_Connector_Registry *conn_reg = + this->orb_core_->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + int retv = + conn_reg->make_mprofile (str, + mprofile + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CORBA::Object::_nil ()); // Return nil. if (retv != 0) diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 50afe27d054..8748002228a 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -14,7 +14,6 @@ #include "Stub.h" #include "Leader_Follower.h" #include "Connector_Registry.h" -#include "Acceptor_Registry.h" #include "Sync_Strategies.h" @@ -26,15 +25,16 @@ #include "Invocation.h" #include "BiDir_Adapter.h" -#include "tao/Thread_Lane_Resources.h" -#include "tao/Thread_Lane_Resources_Manager.h" -#include "tao/Collocation_Resolver.h" -#include "tao/Stub_Factory.h" - -#include "tao/Endpoint_Selector_Factory.h" -#include "tao/Request_Dispatcher.h" +#include "Collocation_Resolver.h" +#include "Endpoint_Selector_Factory.h" #include "Flushing_Strategy.h" +#include "Request_Dispatcher.h" +#include "Stub_Factory.h" +#include "Thread_Lane_Resources.h" +#include "Thread_Lane_Resources_Manager.h" + + #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) # include "Buffering_Constraint_Policy.h" @@ -103,7 +103,6 @@ ACE_CString TAO_ORB_Core::poa_factory_directive_ = TAO_ORB_Core::TAO_ORB_Core (const char *orbid) : protocols_hooks_ (0), lock_ (), - connector_registry_ (0), thread_lane_resources_manager_ (0), collocation_resolver_ (0), stub_factory_ (0), @@ -1033,28 +1032,6 @@ TAO_ORB_Core::init (int &argc, char *argv[] ACE_ENV_ARG_DECL) CORBA::COMPLETED_NO), -1); - // Initialize the connector registry and create a connector for each - // configured protocol. - if (this->connector_registry ()->open (this) != 0) - ACE_THROW_RETURN (CORBA::INITIALIZE ( - CORBA::SystemException::_tao_minor_code ( - TAO_ORB_CORE_INIT_LOCATION_CODE, - 0), - CORBA::COMPLETED_NO), - -1); - -#if 0 - /* - * TODO: No support for preconnect. Needs to be removed, when - * things settle down. - * - */ - // Have the connector registry parse the preconnects. - if (this->orb_params ()->preconnects ().is_empty () == 0) - this->connector_registry ()->preconnect ( - this, - this->orb_params ()->preconnects ()); -#endif /*if 0*/ // Look for BiDirectional library here. If the user has svc.conf // file, load the library at this point. @@ -1117,14 +1094,6 @@ TAO_ORB_Core::fini (void) this->orbid_)); } - // Close connectors before acceptors! - // Ask the registry to close all registered connectors. - if (this->connector_registry_ != 0) - { - this->connector_registry_->close_all (); - delete this->connector_registry_; - } - // Finalize lane resources. // // @@ Do not call this->thread_lane_resources_manager().finalize(). @@ -2099,11 +2068,14 @@ TAO_ORB_Core::resolve_rir (const char *name } else { + TAO_Connector_Registry *conn_reg = + this->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + // Obtain the appropriate object key delimiter for the // specified protocol. object_key_delimiter = - this->connector_registry ()->object_key_delimiter ( - list_of_profiles.c_str ()); + conn_reg->object_key_delimiter (list_of_profiles.c_str ()); } // Make sure that the default initial reference doesn't end @@ -2532,6 +2504,16 @@ TAO_ORB_Core::create_data_block_i (size_t size, return nb; } +TAO_Connector_Registry * +TAO_ORB_Core::connector_registry (ACE_ENV_SINGLE_ARG_DECL) +{ + TAO_Connector_Registry *conn = + this->lane_resources ().connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return conn; +} + ACE_Reactor * TAO_ORB_Core::reactor (void) { diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index bd7aefd0e0e..a8f1915442b 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -228,7 +228,7 @@ public: //@} ///Get the connector registry - TAO_Connector_Registry *connector_registry (void); + TAO_Connector_Registry *connector_registry (ACE_ENV_SINGLE_ARG_DECL); ///Get the IOR parser registry TAO_Parser_Registry *parser_registry (void); @@ -1002,10 +1002,6 @@ protected: /// Synchronize internal state... TAO_SYNCH_MUTEX lock_; - /// The connector registry which all active connectors must register - /// themselves with. - TAO_Connector_Registry *connector_registry_; - TAO_Thread_Lane_Resources_Manager *thread_lane_resources_manager_; TAO_Collocation_Resolver *collocation_resolver_; diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index bdd00420929..cad6f604237 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -222,12 +222,6 @@ TAO_ORB_Core::protocol_factories (void) return TAO_OC_RETRIEVE (protocol_factories); } -ACE_INLINE TAO_Connector_Registry * -TAO_ORB_Core::connector_registry (void) -{ - return TAO_OC_RETRIEVE (connector_registry); -} - ACE_INLINE TAO_Parser_Registry * TAO_ORB_Core::parser_registry (void) { diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index cbf25d28427..21e3f91633c 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -84,7 +84,7 @@ CORBA_Object::_remove_ref (void) { if (this->refcount_lock_ != 0) { - { + { ACE_GUARD (TAO_SYNCH_MUTEX, mon, *this->refcount_lock_); this->refcount_--; @@ -92,8 +92,8 @@ CORBA_Object::_remove_ref (void) if (this->refcount_ != 0) return; } - - delete this; + + delete this; } } @@ -593,29 +593,6 @@ operator>> (TAO_InputCDR& cdr, CORBA_Object*& x) } } - TAO_Connector_Registry *connector_registry = - orb_core->connector_registry (); - for (CORBA::ULong i = 0; i != profile_count && cdr.good_bit (); ++i) - { - TAO_Profile *pfile = - connector_registry->create_profile (cdr); - if (pfile != 0) - mp.give_profile (pfile); - } - - // Make sure we got some profiles! - if (mp.profile_count () != profile_count) - { - // @@ This occurs when profile creation fails when decoding the - // profile from the IOR. - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("TAO (%P|%t) ERROR: Could not create all ") - ACE_LIB_TEXT ("profiles while extracting object\n") - ACE_LIB_TEXT ("TAO (%P|%t) ERROR: reference from the ") - ACE_LIB_TEXT ("CDR stream.\n")), - 0); - } - // Ownership of type_hint is given to TAO_Stub // TAO_Stub will make a copy of mp! @@ -624,9 +601,35 @@ operator>> (TAO_InputCDR& cdr, CORBA_Object*& x) ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { + TAO_Connector_Registry *connector_registry = + orb_core->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + for (CORBA::ULong i = 0; i != profile_count && cdr.good_bit (); ++i) + { + TAO_Profile *pfile = + connector_registry->create_profile (cdr); + if (pfile != 0) + mp.give_profile (pfile); + } + + // Make sure we got some profiles! + if (mp.profile_count () != profile_count) + { + // @@ This occurs when profile creation fails when decoding the + // profile from the IOR. + ACE_ERROR_RETURN ((LM_ERROR, + ACE_LIB_TEXT ("TAO (%P|%t) ERROR: Could not create all ") + ACE_LIB_TEXT ("profiles while extracting object\n") + ACE_LIB_TEXT ("TAO (%P|%t) ERROR: reference from the ") + ACE_LIB_TEXT ("CDR stream.\n")), + 0); + } + + objdata = orb_core->create_stub (type_hint.in (), mp - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } ACE_CATCHANY diff --git a/TAO/tao/Thread_Lane_Resources.cpp b/TAO/tao/Thread_Lane_Resources.cpp index 100b355798b..71baf804d7e 100644 --- a/TAO/tao/Thread_Lane_Resources.cpp +++ b/TAO/tao/Thread_Lane_Resources.cpp @@ -8,8 +8,10 @@ ACE_RCSID(tao, Thread_Lane_Resources, "$Id$") #include "tao/Acceptor_Registry.h" #include "tao/Transport_Cache_Manager.h" #include "tao/Leader_Follower.h" +#include "Connector_Registry.h" #include "ace/Reactor.h" + #if !defined (__ACE_INLINE__) # include "tao/Thread_Lane_Resources.i" #endif /* ! __ACE_INLINE__ */ @@ -18,6 +20,7 @@ TAO_Thread_Lane_Resources::TAO_Thread_Lane_Resources (TAO_ORB_Core &orb_core, TAO_New_Leader_Generator *new_leader_generator) : orb_core_ (orb_core), acceptor_registry_ (0), + connector_registry_ (0), transport_cache_ (0), leader_follower_ (0), new_leader_generator_ (new_leader_generator) @@ -30,6 +33,7 @@ TAO_Thread_Lane_Resources::TAO_Thread_Lane_Resources (TAO_ORB_Core &orb_core, TAO_Thread_Lane_Resources::~TAO_Thread_Lane_Resources (void) { + } TAO_Transport_Cache_Manager & @@ -59,9 +63,15 @@ TAO_Thread_Lane_Resources::acceptor_registry (void) // Double check. if (this->acceptor_registry_ == 0) { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, *this->acceptor_registry_); + // @@todo: Wouldnt this crash big time if you happen to + // dereference a null-pointer? Needs fixing. + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + ace_mon, + this->lock_, + *this->acceptor_registry_); if (this->acceptor_registry_ == 0) { + // @@ Not exception safe code // Get the resource factory. TAO_Resource_Factory &resource_factory = *this->orb_core_.resource_factory (); @@ -75,6 +85,46 @@ TAO_Thread_Lane_Resources::acceptor_registry (void) return *this->acceptor_registry_; } +TAO_Connector_Registry * +TAO_Thread_Lane_Resources::connector_registry (ACE_ENV_SINGLE_ARG_DECL) +{ + // Double check. + if (this->connector_registry_ == 0) + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + if (this->connector_registry_ == 0) + { + // Ask it to create a new acceptor registry. + this->connector_registry_ = + this->orb_core_.resource_factory ()->get_connector_registry (); + + if (this->connector_registry_ == 0) + ACE_THROW_RETURN (CORBA::INITIALIZE ( + CORBA::SystemException::_tao_minor_code ( + TAO_CONNECTOR_REGISTRY_INIT_LOCATION_CODE, + 0), + CORBA::COMPLETED_NO), + 0); + } + + if (this->connector_registry_->open (&this->orb_core_) != 0) + ACE_THROW_RETURN (CORBA::INITIALIZE ( + CORBA::SystemException::_tao_minor_code ( + TAO_CONNECTOR_REGISTRY_INIT_LOCATION_CODE, + 0), + CORBA::COMPLETED_NO), + 0); + + } + + return this->connector_registry_; +} + + TAO_Leader_Follower & TAO_Thread_Lane_Resources::leader_follower (void) { @@ -95,6 +145,8 @@ TAO_Thread_Lane_Resources::leader_follower (void) return *this->leader_follower_; } + + int TAO_Thread_Lane_Resources::open_acceptor_registry (int ignore_address ACE_ENV_ARG_DECL) @@ -117,6 +169,14 @@ TAO_Thread_Lane_Resources::open_acceptor_registry (int ignore_address void TAO_Thread_Lane_Resources::finalize (void) { + // Close connectors before acceptors! + // Ask the registry to close all registered connectors. + if (this->connector_registry_ != 0) + { + this->connector_registry_->close_all (); + delete this->connector_registry_; + } + // Ask the registry to close all registered acceptors. if (this->acceptor_registry_ != 0) { diff --git a/TAO/tao/Thread_Lane_Resources.h b/TAO/tao/Thread_Lane_Resources.h index 53aea870e25..4cbdbc41585 100644 --- a/TAO/tao/Thread_Lane_Resources.h +++ b/TAO/tao/Thread_Lane_Resources.h @@ -29,6 +29,7 @@ class TAO_Transport_Cache_Manager; class TAO_Leader_Follower; class TAO_MProfile; class TAO_New_Leader_Generator; +class TAO_Connector_Registry; /** * @class TAO_Thread_Lane_Resources @@ -66,6 +67,12 @@ public: TAO_Acceptor_Registry &acceptor_registry (void); + /* + * @@ NOTE: Returning a pointer helps to return 0 in case of + * exceptions. + */ + TAO_Connector_Registry *connector_registry (ACE_ENV_SINGLE_ARG_DECL); + TAO_Transport_Cache_Manager &transport_cache (void); TAO_Leader_Follower &leader_follower (void); @@ -84,6 +91,10 @@ private: /// each loaded protocol. TAO_Acceptor_Registry *acceptor_registry_; + /// The connector registry which all active connectors must register + /// themselves with. + TAO_Connector_Registry *connector_registry_; + /// Transport cache. TAO_Transport_Cache_Manager *transport_cache_; diff --git a/TAO/tao/corbafwd.h b/TAO/tao/corbafwd.h index 6f6a18da852..260094042ac 100644 --- a/TAO/tao/corbafwd.h +++ b/TAO/tao/corbafwd.h @@ -1562,6 +1562,7 @@ TAO_NAMESPACE_CLOSE // end of class (namespace) CORBA #define TAO_GUARD_FAILURE (0x10U << 7) #define TAO_POA_BEING_DESTROYED (0x11U << 7) #define TAO_POA_INACTIVE (0x12U << 7) +#define TAO_CONNECTOR_REGISTRY_INIT_LOCATION_CODE (0x13U << 7) // *Don't* use TAO__MINOR_CODE greater than 0x1FU! // errno encoding: bottom 7 bits. @@ -1620,10 +1621,10 @@ operator<< (TAO_OutputCDR&, const TAO_opaque&); TAO_Export CORBA::Boolean operator>> (TAO_InputCDR&, TAO_opaque&); -TAO_Export CORBA::Boolean +TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::TCKind &); -TAO_Export CORBA::Boolean +TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::TCKind &); class TAO_ObjectKey; -- cgit v1.2.1