diff options
author | Angelo Corsaro <angelo@icorsaro.net> | 2000-10-12 03:00:40 +0000 |
---|---|---|
committer | Angelo Corsaro <angelo@icorsaro.net> | 2000-10-12 03:00:40 +0000 |
commit | bdbd7e557119e9584dc37b61fbc290e38219abb0 (patch) | |
tree | 1edd25872458e83ad558f540a48ffada21dcd08b /TAO/tao | |
parent | caa0d2cd96ba8f0d0e0b0e3c268479d8296c29e4 (diff) | |
download | ATCD-bdbd7e557119e9584dc37b61fbc290e38219abb0.tar.gz |
ChangeLog: Wed Oct 11 22:00:00 2000 Angelo Corsaro <corsaro@cs.wustl.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/MProfile.cpp | 29 | ||||
-rw-r--r-- | TAO/tao/MProfile.h | 5 | ||||
-rw-r--r-- | TAO/tao/MProfile.i | 35 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/Object.cpp | 13 | ||||
-rw-r--r-- | TAO/tao/Object.h | 8 | ||||
-rw-r--r-- | TAO/tao/PortableServer/Strategized_Object_Proxy_Broker.cpp | 25 | ||||
-rw-r--r-- | TAO/tao/Profile.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/Stub.cpp | 1 |
9 files changed, 82 insertions, 40 deletions
diff --git a/TAO/tao/MProfile.cpp b/TAO/tao/MProfile.cpp index 6ceeeeb928d..3adf244f6c9 100644 --- a/TAO/tao/MProfile.cpp +++ b/TAO/tao/MProfile.cpp @@ -218,3 +218,32 @@ TAO_MProfile::hash (CORBA::ULong max, CORBA::Environment &ACE_TRY_ENV) // simply take the average value and round. return hashval / last_; } + +void +TAO_MProfile::init_policy_list (void) +{ + // The first time this method is called + // it causes the initialization of the policies + // for the current profile. + + this->get_current_profile ()->policies (); + this->is_policy_list_initialized_ = 1; +} + +CORBA::PolicyList* +TAO_MProfile::policy_list (void) +{ + if (this->is_policy_list_initialized_) + return this->policy_list_; + else + { + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, + guard, + this->mutex_, + 0); + this->create_policy_list (); + this->init_policy_list (); + } + + return this->policy_list_; +} diff --git a/TAO/tao/MProfile.h b/TAO/tao/MProfile.h index cb71dab7c9a..977c5647089 100644 --- a/TAO/tao/MProfile.h +++ b/TAO/tao/MProfile.h @@ -173,6 +173,11 @@ public: protected: + void init_policy_list (void); + // Initialize the policy list, demarsharling the policy. + +protected: + friend class TAO_Profile; CORBA::PolicyList *policy_list_; // Stores the policy list for the profile of this MProfile. diff --git a/TAO/tao/MProfile.i b/TAO/tao/MProfile.i index 0efb6bdc6ff..d13887e406b 100644 --- a/TAO/tao/MProfile.i +++ b/TAO/tao/MProfile.i @@ -1,6 +1,7 @@ // This may look like C, but it's really -*- C++ -*- // $Id$ + ACE_INLINE TAO_MProfile::TAO_MProfile (CORBA::ULong sz) : policy_list_ (0), @@ -17,6 +18,7 @@ TAO_MProfile::TAO_MProfile (CORBA::ULong sz) ACE_INLINE TAO_MProfile::TAO_MProfile (const TAO_MProfile &mprofiles) : policy_list_ (0), + is_policy_list_initialized_ (0), forward_from_(0), pfiles_ (0), current_ (0), @@ -272,36 +274,3 @@ TAO_MProfile::policy_list (CORBA::PolicyList *policy_list) { this->policy_list_ = policy_list; } - -ACE_INLINE CORBA::PolicyList* -TAO_MProfile::policy_list (void) -{ - - // Here we use Double-Checked Loking to - // avoid to create more then one policy list - // if more thread try to get a policy for - // the first time, at the same time. - - if (this->is_policy_list_initialized_) - return this->policy_list_; - else - { - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, - guard, - this->mutex_, - 0); - if (this->policy_list_ == 0) - { - this->create_policy_list (); - this->is_policy_list_initialized_ = 1; - // Init Policy. - this->get_current_profile ()->policies (); - // Right now all the profile share the same - // policies, so any profile can be picked up - // to parse the policy. - // So we pick the current profile, so that no - // state is changed in the MProfile. - } - } - return this->policy_list_; -} diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 6a141dda4ab..ab58fc19ccf 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1653,8 +1653,6 @@ TAO_ORB_Core::create_stub_object (const TAO_ObjectKey &key, if (policy_list->length () != 0) { - // Set the "iterator" to the beginning of MProfile. - mp.rewind (); TAO_Profile * profile; for (CORBA::ULong i = 0; i < mp.profile_count (); ++i) diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index c5d630bf77b..d0688c7e638 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -44,8 +44,13 @@ CORBA_Object::CORBA_Object (TAO_Stub *protocol_proxy, // the semantics of CORBA Objects are such that obtaining one // implicitly takes a reference. - // By default the proxy broker is set to the one - // that always goes remote. + // If the object is collocated then set the broker + // using the factory otherwise use the remote proxy + // broker. + if (this->is_collocated_ && + _TAO_collocation_Object_Proxy_Broker_Factory_function_pointer != 0) + this->proxy_broker_ = _TAO_collocation_Object_Proxy_Broker_Factory_function_pointer (this); + else this->proxy_broker_ = the_tao_remote_object_proxy_broker (); } @@ -649,6 +654,10 @@ operator>> (TAO_InputCDR& cdr, CORBA_Object*& x) return (CORBA::Boolean) cdr.good_bit (); } +TAO_Object_Proxy_Broker * (*_TAO_collocation_Object_Proxy_Broker_Factory_function_pointer) ( + CORBA::Object_ptr obj + ) = 0; + // **************************************************************** #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h index 8ebd523ed16..600c8a433cd 100644 --- a/TAO/tao/Object.h +++ b/TAO/tao/Object.h @@ -327,6 +327,14 @@ private: CORBA::Object_ptr &ptr_; }; + +extern TAO_Export TAO_Object_Proxy_Broker * (*_TAO_collocation_Object_Proxy_Broker_Factory_function_pointer) ( + CORBA::Object_ptr obj + ); + +// This function pointer is set only when the Portable server library is +// present. + TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR&, const CORBA_Object*); diff --git a/TAO/tao/PortableServer/Strategized_Object_Proxy_Broker.cpp b/TAO/tao/PortableServer/Strategized_Object_Proxy_Broker.cpp index a95ae9c7bce..b4564aaad7a 100644 --- a/TAO/tao/PortableServer/Strategized_Object_Proxy_Broker.cpp +++ b/TAO/tao/PortableServer/Strategized_Object_Proxy_Broker.cpp @@ -9,6 +9,8 @@ ACE_RCSID (tao, TAO_Strategized_Object_Proxy_Broker, "$Id$") + + TAO_Strategized_Object_Proxy_Broker * the_tao_strategized_object_proxy_broker (void) { @@ -89,3 +91,26 @@ TAO_Strategized_Object_Proxy_Broker::create_proxy (TAO_ORB_Core::TAO_Collocation } } } + +TAO_Object_Proxy_Broker * _TAO_collocation_Object_Proxy_Broker_Factory ( + CORBA::Object_ptr obj + ) +{ + + return the_tao_strategized_object_proxy_broker (); +} + +int _TAO_collocation_Object_Proxy_Broker_Factory_Initializer (long dummy) +{ + ACE_UNUSED_ARG (dummy); + + _TAO_collocation_Object_Proxy_Broker_Factory_function_pointer = + _TAO_collocation_Object_Proxy_Broker_Factory; + + return 0; +} + +static int +_TAO_collocation_Object_Proxy_Broker_Factory_Initializer_Scarecrow = +_TAO_collocation_Object_Proxy_Broker_Factory_Initializer (ACE_reinterpret_cast (long, + _TAO_collocation_Object_Proxy_Broker_Factory_Initializer)); diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp index 4fc7790e2f4..3f69792e415 100644 --- a/TAO/tao/Profile.cpp +++ b/TAO/tao/Profile.cpp @@ -117,7 +117,7 @@ TAO_Profile::policies (void) { #if (TAO_HAS_CORBA_MESSAGING == 1) - CORBA::PolicyList *policies = this->stub_->base_profiles ().policy_list (); + CORBA::PolicyList *policies = this->stub_->base_profiles ().policy_list_; if (!this->are_policies_parsed_) // None has already parsed the policies. @@ -193,7 +193,7 @@ TAO_Profile::policies (void) #endif /* (TAO_HAS_CORBA_MESSAGING == 1) */ - return *(stub_->base_profiles ().policy_list ()); + return *(stub_->base_profiles ().policy_list_); } void diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp index ce6ab76a037..b8746659cf3 100644 --- a/TAO/tao/Stub.cpp +++ b/TAO/tao/Stub.cpp @@ -94,7 +94,6 @@ ACE_RCSID(tao, TAO_Stub, "$Id$") this->orb_core_->client_factory ()->create_profile_lock (); this->base_profiles (profiles); - this->base_profiles_.rewind (); TAO_Profile *profile = 0; for (CORBA::ULong i = 0; i < this->base_profiles_.profile_count (); ++i) { |