#include <Stub.h>
Collaboration diagram for TAO_Stub:
Public Member Functions | |
virtual CORBA::Policy_ptr | get_policy (CORBA::PolicyType type) |
virtual CORBA::Policy_ptr | get_cached_policy (TAO_Cached_Policy_Type type) |
virtual TAO_Stub * | set_policy_overrides (const CORBA::PolicyList &policies, CORBA::SetOverrideType set_add) |
virtual CORBA::PolicyList * | get_policy_overrides (const CORBA::PolicyTypeSeq &types) |
TAO::Transport_Queueing_Strategy * | transport_queueing_strategy (void) |
CORBA::ULong | hash (CORBA::ULong maximum) |
CORBA::Boolean | is_equivalent (CORBA::Object_ptr other_obj) |
Implement the is_equivalent() method for the CORBA::Object. | |
TAO_Stub (const char *repository_id, const TAO_MProfile &profiles, TAO_ORB_Core *orb_core) | |
Construct from a repository ID and a list of profiles. | |
void | _incr_refcnt (void) |
void | _decr_refcnt (void) |
ACE_Lock * | profile_lock (void) const |
TAO_Profile * | profile_in_use (void) |
const TAO::ObjectKey & | object_key (void) const |
Return the ObjectKey. | |
TAO_MProfile * | make_profiles (void) |
const TAO_MProfile & | base_profiles (void) const |
Obtain a reference to the basic profile set. | |
TAO_MProfile & | base_profiles (void) |
Obtain a reference to the basic profile set. | |
const TAO_MProfile * | forward_profiles (void) const |
Obtain a pointer to the forwarded profile set. | |
TAO_Profile * | next_profile (void) |
True if permanent location forward occured, in this case the lock must be set and the. | |
void | reset_profiles (void) |
CORBA::Boolean | valid_forward_profile (void) |
void | set_valid_profile (void) |
NON-THREAD-SAFE. Will set profile_success_ to 0. | |
CORBA::Boolean | valid_profile (void) const |
TAO_Profile * | base_profiles (const TAO_MProfile &mprofiles) |
void | add_forward_profiles (const TAO_MProfile &mprofiles, const CORBA::Boolean permanent_forward=false) |
CORBA::Boolean | next_profile_retry (void) |
TAO_ORB_Core * | orb_core (void) const |
Accessor. | |
CORBA::Boolean | is_collocated (void) const |
Is this stub collocated with the servant? | |
void | is_collocated (CORBA::Boolean) |
Mutator to mark this stub as being collocated with the servant. | |
CORBA::ORB_ptr | servant_orb_ptr (void) |
This returns a duplicated ORB pointer. | |
CORBA::ORB_var & | servant_orb_var (void) |
This returns the ORB var itself (generally for temporary use). | |
void | servant_orb (CORBA::ORB_ptr orb) |
void | collocated_servant (TAO_Abstract_ServantBase *servant) |
Mutator for setting the servant in collocated cases. | |
TAO_Abstract_ServantBase * | collocated_servant (void) const |
Accessor for the servant reference in collocated cases. | |
void | object_proxy_broker (TAO::Object_Proxy_Broker *proxy_broker) |
TAO::Object_Proxy_Broker * | object_proxy_broker (void) const |
int | create_ior_info (IOP::IOR *&ior_info, CORBA::ULong &index) |
void | destroy (void) |
Deallocate the TAO_Stub object. | |
CORBA::Boolean | optimize_collocation_objects (void) const |
Return the cached value from the ORB_Core. | |
CORBA::Boolean | marshal (TAO_OutputCDR &) |
Needed to avoid copying forward_profiles for thread safety. | |
Public Attributes | |
CORBA::String_var | type_id |
All objref representations carry around a type ID. | |
Protected Member Functions | |
virtual | ~TAO_Stub (void) |
void | reset_profiles_i (void) |
NON-THREAD SAFE version of reset_profiles (void);. | |
TAO_Profile * | next_profile_i (void) |
NON-THREAD SAFE version of next_profile (void). | |
Protected Attributes | |
TAO_ORB_Core_Auto_Ptr | orb_core_ |
Automatically manage the ORB_Core reference count. | |
CORBA::ORB_var | orb_ |
CORBA::Boolean | is_collocated_ |
CORBA::ORB_var | servant_orb_ |
TAO_Abstract_ServantBase * | collocated_servant_ |
Servant pointer. It is 0 except for collocated objects. | |
TAO::Object_Proxy_Broker * | object_proxy_broker_ |
Pointer to the Proxy Broker. | |
TAO_MProfile | base_profiles_ |
Ordered list of profiles for this object. | |
TAO_MProfile * | forward_profiles_ |
TAO_MProfile * | forward_profiles_perm_ |
TAO_Profile * | profile_in_use_ |
This is the profile that we are currently sending/receiving with. | |
ACE_Lock * | profile_lock_ptr_ |
Mutex to protect access to the forwarding profile. | |
CORBA::Boolean | profile_success_ |
Have we successfully talked to the forward profile yet? | |
ACE_Atomic_Op< TAO_SYNCH_MUTEX, unsigned long > | refcount_ |
Reference counter. | |
TAO_Policy_Set * | policies_ |
IOP::IOR * | ior_info_ |
IOP::IOR * | forwarded_ior_info_ |
Forwarded IOR info. | |
const CORBA::Boolean | collocation_opt_ |
Private Member Functions | |
TAO_Profile * | set_profile_in_use_i (TAO_Profile *pfile) |
void | reset_base () |
void | forward_back_one (void) |
void | reset_forward () |
TAO_Profile * | next_forward_profile (void) |
NON-THREAD-SAFE. utility method for next_profile. | |
int | get_profile_ior_info (TAO_MProfile &profile, IOP::IOR *&ior_info) |
THREAD-SAFE Create the IOR info. | |
TAO_Stub (const TAO_Stub &) | |
TAO_Stub & | operator= (const TAO_Stub &) |
Per-objref data includes the (protocol-specific) Profile, which is handled by placing it into a subclass of this type along with data that may be used in protocol-specific caching schemes. The type ID (the data specified by CORBA 2.0 that gets exposed "on the wire", and in stringified objrefs) is held by this module. The stub APIs are member functions of this type.
Definition at line 69 of file Stub.h.
|
Construct from a repository ID and a list of profiles.
Definition at line 36 of file Stub.cpp. References CORBA::ORB::_duplicate(), ACE_DEBUG, ACE_TEXT, base_profiles(), TAO_ORB_Core_Auto_Ptr::get(), LM_DEBUG, profile_lock_ptr_, TAO_ORB_Core_Auto_Ptr::reset(), TAO_debug_level, TAO_HAS_CORBA_MESSAGING, TAO_ORB_Core_instance(), and the_tao_remote_object_proxy_broker().
00039 : type_id (repository_id) 00040 , orb_core_ (orb_core) 00041 , orb_ () 00042 , is_collocated_ (false) 00043 , servant_orb_ () 00044 , collocated_servant_ (0) 00045 , object_proxy_broker_ (the_tao_remote_object_proxy_broker ()) 00046 , base_profiles_ ((CORBA::ULong) 0) 00047 , forward_profiles_ (0) 00048 , forward_profiles_perm_ (0) 00049 , profile_in_use_ (0) 00050 , profile_lock_ptr_ (0) 00051 , profile_success_ (false) 00052 , refcount_ (1) 00053 #if (TAO_HAS_CORBA_MESSAGING == 1) 00054 , policies_ (0) 00055 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ 00056 , ior_info_ (0) 00057 , forwarded_ior_info_ (0) 00058 , collocation_opt_ (orb_core->optimize_collocation_objects ()) 00059 { 00060 if (this->orb_core_.get() == 0) 00061 { 00062 if (TAO_debug_level > 0) 00063 { 00064 ACE_DEBUG ((LM_DEBUG, 00065 ACE_TEXT ("TAO: (%P|%t) TAO_Stub created with default ") 00066 ACE_TEXT ("ORB core\n"))); 00067 } 00068 00069 this->orb_core_.reset (TAO_ORB_Core_instance ()); 00070 } 00071 00072 // Duplicate the ORB_Core, otherwise the allocators and other 00073 // resources that this class references (directly or indirectly) 00074 // could be destroyed before it is time. 00075 (void) this->orb_core_->_incr_refcnt (); 00076 00077 // Cache the ORB pointer to respond faster to certain queries. 00078 this->orb_ = CORBA::ORB::_duplicate (this->orb_core_->orb ()); 00079 00080 this->profile_lock_ptr_ = 00081 this->orb_core_->client_factory ()->create_profile_lock (); 00082 00083 this->base_profiles (profiles); 00084 } |
|
Destructor is to be called only through _decr_refcnt() to enforce proper reference counting. Definition at line 86 of file Stub.cpp. References TAO_Profile::_decr_refcnt(), ACE_ASSERT, forward_profiles_, forwarded_ior_info_, ior_info_, policies_, profile_in_use_, profile_lock_ptr_, and reset_profiles().
00087 { 00088 ACE_ASSERT (this->refcount_ == 0); 00089 00090 if (this->forward_profiles_) 00091 reset_profiles (); 00092 00093 if (this->profile_in_use_ != 0) 00094 { 00095 // decrease reference count on profile 00096 this->profile_in_use_->_decr_refcnt (); 00097 this->profile_in_use_ = 0; 00098 } 00099 00100 delete this->profile_lock_ptr_; 00101 00102 #if (TAO_HAS_CORBA_MESSAGING == 1) 00103 00104 delete this->policies_; 00105 00106 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ 00107 00108 if (this->ior_info_) 00109 delete this->ior_info_; 00110 00111 if (this->forwarded_ior_info_) 00112 delete this->forwarded_ior_info_; 00113 } |
|
|
|
Definition at line 561 of file Stub.cpp. Referenced by TAO_Stub_Auto_Ptr::reset(), CORBA::Object::~Object(), and TAO_Stub_Auto_Ptr::~TAO_Stub_Auto_Ptr().
00562 { 00563 if (--this->refcount_ == 0) 00564 delete this; 00565 } |
|
Definition at line 555 of file Stub.cpp. Referenced by TAO::Narrow_Utils< T >::unchecked_narrow().
00556 { 00557 ++this->refcount_; 00558 } |
|
THREAD SAFE. Set the forward_profiles. This object will assume ownership of this TAO_MProfile object!! if permanent_forward is true, currently used profiles will be replaced permanently, otherwise stub may fallback to current profiles later. The flag permanent_forward=true is only valid if currently used profile set represents a GroupObject (IOGR), otherwise this flag will be ignored. Definition at line 116 of file Stub.cpp. References ACE_GUARD, ACE_NEW, base_profiles_, forward_profiles_, forward_profiles_perm_, TAO_Profile::forward_to(), profile_in_use_, profile_success_, and reset_forward(). Referenced by TAO::LocateRequest_Invocation_Adapter::object_forwarded(), and TAO::Invocation_Adapter::object_forwarded().
00118 { 00119 // we assume that the profile_in_use_ is being 00120 // forwarded! Grab the lock so things don't change. 00121 ACE_MT (ACE_GUARD (ACE_Lock, 00122 guard, 00123 *this->profile_lock_ptr_)); 00124 00125 if (permanent_forward) 00126 { 00127 // paranoid, reset the bookmark, then clear the forward-stack 00128 this->forward_profiles_perm_ = 0; 00129 00130 this->reset_forward (); 00131 } 00132 00133 TAO_MProfile *now_pfiles = this->forward_profiles_; 00134 if (now_pfiles == 0) 00135 now_pfiles = &this->base_profiles_; 00136 00137 ACE_NEW (this->forward_profiles_, 00138 TAO_MProfile (mprofiles)); 00139 00140 if (permanent_forward) 00141 // bookmark the new element at bottom of stack 00142 this->forward_profiles_perm_ = this->forward_profiles_; 00143 00144 // forwarded profile points to the new IOR (profiles) 00145 this->profile_in_use_->forward_to (this->forward_profiles_); 00146 00147 // new profile list points back to the list which was forwarded. 00148 this->forward_profiles_->forward_from (now_pfiles); 00149 00150 // make sure we start at the beginning of mprofiles 00151 this->forward_profiles_->rewind (); 00152 00153 // Since we have been forwarded, we must set profile_success_ to false 00154 // since we are starting a new with a new set of profiles! 00155 this->profile_success_ = false; 00156 } |
|
Initialize the base_profiles_ and set profile_in_use_ to reference the first profile. Definition at line 172 of file Stub.inl. References ACE_GUARD_RETURN, base_profiles_, profile_in_use_, reset_base(), reset_forward(), and TAO_MProfile::set().
00173 { 00174 ACE_MT (ACE_GUARD_RETURN (ACE_Lock, 00175 guard, 00176 *this->profile_lock_ptr_, 00177 0)); 00178 00179 // first reset things so we start from scratch! 00180 00181 // @note This reset forward could effect the collocation status 00182 // but as this method is only used from the Stub ctr, when the status 00183 // is already correctly set, we don't reinitialise here. sm. 00184 this->reset_forward (); 00185 this->base_profiles_.set (mprofiles); 00186 this->reset_base (); 00187 return this->profile_in_use_; 00188 00189 } |
|
Obtain a reference to the basic profile set.
Definition at line 224 of file Stub.inl. References base_profiles_.
00225 { 00226 return this->base_profiles_; 00227 } |
|
Obtain a reference to the basic profile set.
Definition at line 218 of file Stub.inl. References base_profiles_. Referenced by TAO_ORB_Core::create_object(), TAO_ORB_Core::create_stub_object(), TAO_ORB_Core::initialize_object(), TAO::LocateRequest_Invocation_Adapter::object_forwarded(), TAO::Invocation_Adapter::object_forwarded(), CORBA::ORB::object_to_string(), TAO_ORB_Core::reinitialize_object(), and TAO_Stub().
00219 { 00220 return this->base_profiles_; 00221 } |
|
Accessor for the servant reference in collocated cases.
Definition at line 268 of file Stub.inl. References collocated_servant_.
00269 { 00270 return collocated_servant_; 00271 } |
|
Mutator for setting the servant in collocated cases.
Definition at line 274 of file Stub.inl. References collocated_servant_. Referenced by CORBA::Object::_servant(), TAO_Adapter_Registry::create_collocated_object(), CORBA::Object::Object(), and CORBA::Object::set_collocated_servant().
00275 { 00276 this->collocated_servant_ = servant; 00277 } |
|
Create the IOP::IOR info. We will create the info at most once. Get the index of the profile we are using to make the invocation. Definition at line 159 of file Stub.cpp. References ACE_GUARD_RETURN, base_profiles_, forward_profiles_, forwarded_ior_info_, TAO_MProfile::get_profile(), get_profile_ior_info(), ior_info_, TAO_MProfile::profile_count(), and profile_in_use_. Referenced by TAO::Remote_Invocation::init_target_spec().
00160 { 00161 // We are creating the IOR info. Let us not be disturbed. So grab a 00162 // lock. 00163 ACE_MT (ACE_GUARD_RETURN (ACE_Lock, 00164 guard, 00165 *this->profile_lock_ptr_, 00166 -1)); 00167 00168 IOP::IOR *tmp_info = 0; 00169 00170 if (this->forward_profiles_ != 0) 00171 { 00172 if (this->forwarded_ior_info_ == 0) 00173 { 00174 this->get_profile_ior_info (*this->forward_profiles_, tmp_info); 00175 00176 this->forwarded_ior_info_ = tmp_info; 00177 } 00178 00179 // First we look at the forward profiles to see whether the 00180 // profile_in_use is any of it. 00181 for (CORBA::ULong i = 0; 00182 i < this->forward_profiles_->profile_count (); 00183 ++i) 00184 { 00185 if (this->forward_profiles_->get_profile (i) 00186 == this->profile_in_use_) 00187 { 00188 ior_info = this->forwarded_ior_info_; 00189 index = i; 00190 return 0; 00191 } 00192 } 00193 } 00194 00195 // Else we look at the base profiles 00196 if (this->ior_info_ == 0) 00197 { 00198 this->get_profile_ior_info (this->base_profiles_, tmp_info); 00199 00200 this->ior_info_ = tmp_info; 00201 } 00202 00203 00204 for (CORBA::ULong ind = 0; 00205 ind < this->base_profiles_.profile_count (); 00206 ++ind) 00207 { 00208 if (this->base_profiles_.get_profile (ind) == this->profile_in_use_) 00209 { 00210 index = ind; 00211 ior_info = this->ior_info_; 00212 return 0; 00213 } 00214 } 00215 00216 // Error, there was no match 00217 return -1; 00218 } |
|
Deallocate the TAO_Stub object. This method is intended to be used only by the CORBA::Object class. Definition at line 292 of file Stub.inl.
00293 { 00294 // The reference count better be zero at this point! 00295 delete this; 00296 } |
|
NON-THREAD-SAFE. Utility method which unrolls (removes or pops) the top most forwarding profile list. Definition at line 349 of file Stub.cpp. References base_profiles_, TAO_MProfile::forward_from(), forward_profiles_, TAO_Profile::forward_to(), and TAO_MProfile::get_current_profile(). Referenced by next_forward_profile(), and reset_forward().
00350 { 00351 TAO_MProfile *from = forward_profiles_->forward_from (); 00352 00353 delete this->forward_profiles_; 00354 00355 // the current profile in this profile list is no 00356 // longer being forwarded, so set the reference to zero. 00357 if (from == &this->base_profiles_) 00358 { 00359 this->base_profiles_.get_current_profile ()->forward_to (0); 00360 this->forward_profiles_ = 0; 00361 } 00362 else 00363 { 00364 from->get_current_profile ()->forward_to (0); 00365 this->forward_profiles_ = from; 00366 } 00367 } |
|
Obtain a pointer to the forwarded profile set.
Definition at line 230 of file Stub.inl. References forward_profiles_. Referenced by TAO_ORB_Core::reinitialize_object().
00231 { 00232 return this->forward_profiles_; 00233 } |
|
Definition at line 420 of file Stub.cpp. References TAO_Objref_Var_T< T >::_retn(), TAO_Policy_Set::get_cached_policy(), TAO_Objref_Var_T< T >::in(), CORBA::is_nil(), policies_, and CORBA::Policy_var. Referenced by CORBA::Object::_get_cached_policy().
00421 { 00422 // No need to lock, the stub only changes its policies at 00423 // construction time... 00424 00425 CORBA::Policy_var result; 00426 if (this->policies_ != 0) 00427 { 00428 result = this->policies_->get_cached_policy (type); 00429 } 00430 00431 if (CORBA::is_nil (result.in ())) 00432 { 00433 result = this->orb_core_->get_cached_policy_including_current (type); 00434 } 00435 00436 return result._retn (); 00437 } |
|
Returns the effective policy if type is a known client-exposed policy type. Returns the effective override for all other policy types. Definition at line 400 of file Stub.cpp. References TAO_Objref_Var_T< T >::_retn(), TAO_Policy_Set::get_policy(), TAO_Objref_Var_T< T >::in(), CORBA::is_nil(), policies_, CORBA::Policy_var, and CORBA::PolicyType. Referenced by CORBA::Object::_get_policy().
00401 { 00402 // No need to lock, the stub only changes its policies at 00403 // construction time... 00404 00405 CORBA::Policy_var result; 00406 if (this->policies_ != 0) 00407 { 00408 result = this->policies_->get_policy (type); 00409 } 00410 00411 if (CORBA::is_nil (result.in ())) 00412 { 00413 result = this->orb_core_->get_policy_including_current (type); 00414 } 00415 00416 return result._retn (); 00417 } |
|
Definition at line 474 of file Stub.cpp. References ACE_NEW_THROW_EX, TAO_Policy_Set::get_policy_overrides(), policies_, CORBA::PolicyList, and CORBA::PolicyTypeSeq. Referenced by CORBA::Object::_get_policy_overrides().
00475 { 00476 if (this->policies_ == 0) 00477 { 00478 CORBA::PolicyList *policy_list_ptr = 0; 00479 ACE_NEW_THROW_EX (policy_list_ptr, 00480 CORBA::PolicyList (), 00481 CORBA::NO_MEMORY ()); 00482 00483 return policy_list_ptr; 00484 } 00485 else 00486 { 00487 return this->policies_->get_policy_overrides (types); 00488 } 00489 } |
|
THREAD-SAFE Create the IOR info.
Definition at line 241 of file Stub.cpp. References ACE_NEW_THROW_EX, TAO_Profile::create_tagged_profile(), TAO_MProfile::get_profile(), TAO_MProfile::profile_count(), and IOP::IOR::profiles. Referenced by create_ior_info().
00242 { 00243 ACE_NEW_THROW_EX (ior_info, 00244 IOP::IOR (), 00245 CORBA::NO_MEMORY ()); 00246 00247 // Get the number of elements 00248 CORBA::ULong const count = profiles.profile_count (); 00249 00250 // Set the number of elements in the sequence of tagged_profile 00251 ior_info->profiles.length (count); 00252 00253 // Call the create_tagged_profile one every member of the 00254 // profile and make the sequence 00255 for (CORBA::ULong index = 0; index < count; ++index) 00256 { 00257 TAO_Profile *prof = profiles.get_profile (index); 00258 00259 IOP::TaggedProfile *tp = prof->create_tagged_profile (); 00260 00261 if (tp == 0) 00262 throw ::CORBA::NO_MEMORY (); 00263 ior_info->profiles[index] = *tp; 00264 } 00265 00266 return 0; 00267 } |
|
All objref representations know how to hash themselves and compare themselves for equivalence to others. It's easily possible to have two objrefs that are distinct copies of data that refers/points to the same remote object (i.e. are equivalent). Definition at line 294 of file Stub.cpp. References base_profiles_, and TAO_MProfile::hash(). Referenced by CORBA::Object::_hash().
00295 { 00296 // we rely on the profile objects that its address info 00297 return this->base_profiles_.hash (max); 00298 } |
|
Mutator to mark this stub as being collocated with the servant.
Definition at line 270 of file Stub.cpp. References _TAO_Object_Proxy_Broker_Factory_function_pointer, is_collocated_, object_proxy_broker_, and the_tao_remote_object_proxy_broker().
00271 { 00272 if (this->is_collocated_ != collocated) 00273 { 00274 if (collocated && 00275 _TAO_Object_Proxy_Broker_Factory_function_pointer != 0) 00276 { 00277 this->object_proxy_broker_ = 00278 _TAO_Object_Proxy_Broker_Factory_function_pointer (); 00279 } 00280 else 00281 { 00282 this->object_proxy_broker_ = the_tao_remote_object_proxy_broker (); 00283 } 00284 this->is_collocated_ = collocated; 00285 } 00286 } |
|
Is this stub collocated with the servant?
Definition at line 236 of file Stub.inl. References is_collocated_. Referenced by CORBA::Object::_is_collocated(), CORBA::Object::Object(), and CORBA::Object::set_collocated_servant().
00237 { 00238 return this->is_collocated_; 00239 } |
|
Implement the is_equivalent() method for the CORBA::Object.
Definition at line 309 of file Stub.cpp. References CORBA::Object::_stubobj(), TAO_Profile::is_equivalent(), CORBA::is_nil(), CORBA::Object_ptr, and profile_in_use_. Referenced by CORBA::Object::_is_equivalent().
00310 { 00311 if (CORBA::is_nil (other_obj)) 00312 return false; 00313 00314 TAO_Profile * const other_profile = other_obj->_stubobj ()->profile_in_use_; 00315 TAO_Profile * const this_profile = this->profile_in_use_; 00316 00317 if (other_profile == 0 || this_profile == 0) 00318 return false; 00319 00320 // Compare the profiles 00321 return this_profile->is_equivalent (other_profile); 00322 } |
|
Copy of the profile list, user must free memory when done. although the user can call make_profiles() then reorder the list and give it back to TAO_Stub. Definition at line 55 of file Stub.inl. References ACE_NEW_RETURN, and base_profiles_.
00056 { 00057 TAO_MProfile *mp = 0; 00058 00059 ACE_NEW_RETURN (mp, 00060 TAO_MProfile (base_profiles_), 00061 0); 00062 00063 return mp; 00064 } |
|
Needed to avoid copying forward_profiles for thread safety.
Definition at line 494 of file Stub.cpp. References ACE_ASSERT, ACE_GUARD_RETURN, base_profiles_, TAO_Profile::encode(), forward_profiles_perm_, TAO_MProfile::get_profile(), ACE_OutputCDR::good_bit(), TAO::String_var< charT >::in(), and TAO_MProfile::profile_count(). Referenced by operator<<().
00495 { 00496 // do as many outside of locked else-branch as posssible 00497 00498 // STRING, a type ID hint 00499 if ((cdr << this->type_id.in()) == 0) 00500 return 0; 00501 00502 if ( ! this->forward_profiles_perm_) 00503 { 00504 const TAO_MProfile& mprofile = this->base_profiles_; 00505 00506 CORBA::ULong const profile_count = mprofile.profile_count (); 00507 if ((cdr << profile_count) == 0) 00508 return 0; 00509 00510 // @@ The MProfile should be locked during this iteration, is there 00511 // anyway to achieve that? 00512 for (CORBA::ULong i = 0; i < profile_count; ++i) 00513 { 00514 const TAO_Profile* p = mprofile.get_profile (i); 00515 if (p->encode (cdr) == 0) 00516 return 0; 00517 } 00518 } 00519 else 00520 { 00521 ACE_MT (ACE_GUARD_RETURN (ACE_Lock, 00522 guard, 00523 *this->profile_lock_ptr_, 00524 0)); 00525 00526 ACE_ASSERT(this->forward_profiles_ !=0); 00527 00528 // paranoid - in case of FT the basic_profiles_ would do, too, 00529 // but might be dated 00530 const TAO_MProfile& mprofile = 00531 this->forward_profiles_perm_ 00532 ? *(this->forward_profiles_perm_) 00533 : this->base_profiles_; 00534 00535 CORBA::ULong const profile_count = mprofile.profile_count (); 00536 if ((cdr << profile_count) == 0) 00537 return 0; 00538 00539 // @@ The MProfile should be locked during this iteration, is there 00540 // anyway to achieve that? 00541 for (CORBA::ULong i = 0; i < profile_count; ++i) 00542 { 00543 const TAO_Profile* p = mprofile.get_profile (i); 00544 if (p->encode (cdr) == 0) 00545 return 0; 00546 } 00547 00548 // release ACE_Lock 00549 } 00550 00551 return (CORBA::Boolean) cdr.good_bit (); 00552 } |
|
NON-THREAD-SAFE. utility method for next_profile.
Definition at line 67 of file Stub.inl. References forward_back_one(), forward_profiles_, forward_profiles_perm_, and TAO_MProfile::get_next(). Referenced by next_profile_i().
00068 { 00069 TAO_Profile *pfile_next = 0; 00070 00071 while (this->forward_profiles_ 00072 && (pfile_next = this->forward_profiles_->get_next ()) == 0 00073 && this->forward_profiles_ != this->forward_profiles_perm_) // do not remove permanent forward from bottom of stack 00074 // that was the last profile. Now we clean up our forward profiles. 00075 // since we own the forward MProfiles, we must delete them when done. 00076 this->forward_back_one (); 00077 00078 return pfile_next; 00079 } |
|
True if permanent location forward occured, in this case the lock must be set and the. THREAD SAFE. If forward_profiles is null then this will get the next profile in the base_profiles list. If forward is not null then this will get the next profile for the list of forwarding profiles. If all profiles have been tried then 0 is returned and profile_in_use_ is set to the first profile in the base_profiles list. Definition at line 143 of file Stub.inl. References ACE_GUARD_RETURN, and next_profile_i(). Referenced by TAO::LocateRequest_Invocation_Adapter::object_forwarded(), and TAO::Invocation_Adapter::object_forwarded().
00144 { 00145 00146 ACE_MT (ACE_GUARD_RETURN (ACE_Lock, 00147 guard, 00148 *this->profile_lock_ptr_, 00149 0)); 00150 return this->next_profile_i (); 00151 } |
|
NON-THREAD SAFE version of next_profile (void).
Definition at line 82 of file Stub.inl. References base_profiles_, forward_profiles_, forward_profiles_perm_, TAO_MProfile::get_next(), next_forward_profile(), profile_success_, reset_base(), TAO_MProfile::rewind(), and set_profile_in_use_i(). Referenced by next_profile(), and next_profile_retry().
00083 { 00084 TAO_Profile *pfile_next = 0; 00085 00086 // First handle the case that a permanent forward occured 00087 if (this->forward_profiles_perm_) // the permanent forward defined 00088 // at bottom of stack 00089 // forward_profiles_ 00090 { 00091 // In case of permanent forward the base_profiles are ingored. 00092 00093 pfile_next = this->next_forward_profile (); 00094 00095 if (pfile_next == 0) 00096 { 00097 // COND: this->forward_profiles_ == this->forward_profiles_perm_ 00098 00099 // reached end of list of permanent forward profiles 00100 // now, reset forward_profiles_perm_ 00101 00102 this->forward_profiles_->rewind (); 00103 this->profile_success_ = false; 00104 this->set_profile_in_use_i (this->forward_profiles_->get_next()); 00105 } 00106 else 00107 this->set_profile_in_use_i (pfile_next); 00108 00109 // We may have been forwarded to / from a collocated situation 00110 // Check for this and apply / remove optimisation if required. 00111 this->orb_core_->reinitialize_object (this); 00112 00113 return pfile_next; 00114 } 00115 else 00116 { 00117 if (this->forward_profiles_) // Now do the common operation 00118 { 00119 pfile_next = this->next_forward_profile (); 00120 if (pfile_next == 0) 00121 { 00122 // Fall back to base profiles 00123 pfile_next = this->base_profiles_.get_next (); 00124 } 00125 00126 // We may have been forwarded to / from a collocated situation 00127 // Check for this and apply / remove optimisation if required. 00128 this->orb_core_->reinitialize_object (this); 00129 } 00130 else 00131 pfile_next = this->base_profiles_.get_next (); 00132 00133 if (pfile_next == 0) 00134 this->reset_base (); 00135 else 00136 this->set_profile_in_use_i (pfile_next); 00137 00138 return pfile_next; 00139 } 00140 } |
|
THREAD SAFE Used to get the next profile after the one being used has failed during the initial connect or send of the message! Definition at line 192 of file Stub.inl. References ACE_GUARD_RETURN, forward_profiles_, next_profile_i(), profile_success_, and reset_profiles_i(). Referenced by TAO::Synch_Twoway_Invocation::handle_system_exception(), and TAO_Default_Endpoint_Selector::select_endpoint().
00193 { 00194 ACE_MT (ACE_GUARD_RETURN (ACE_Lock, 00195 guard, 00196 *this->profile_lock_ptr_, 00197 0)); 00198 00199 if (this->profile_success_ && this->forward_profiles_) 00200 { 00201 // We have a forwarded reference that we have managed to *send* a message to 00202 // previously in the remote path only (but not counting object proxy broker ops). 00203 // @todo I can see little sense to this. It is at best highly inconsistent. sm. 00204 00205 // In this case we are falling back from the forwarded IOR stright to the base IOR 00206 this->reset_profiles_i (); 00207 return true; 00208 } 00209 else if (this->next_profile_i ()) 00210 { 00211 return true; 00212 } 00213 00214 return false; 00215 } |
|
Return the ObjectKey.
Definition at line 221 of file Stub.cpp. References base_profiles_, forward_profiles_, TAO_MProfile::get_profile(), ACE_Guard< ACE_LOCK >::locked(), TAO_Profile::object_key(), and profile_in_use_. Referenced by TAO_ServerRequest::TAO_ServerRequest().
00222 { 00223 // Return the profile in use's object key if you see one. 00224 if (this->profile_in_use_) 00225 return this->profile_in_use_->object_key (); 00226 00227 if (this->forward_profiles_) 00228 { 00229 // Double-checked 00230 ACE_Guard<ACE_Lock> obj (*this->profile_lock_ptr_); 00231 00232 if (obj.locked () != 0 && this->forward_profiles_ != 0) 00233 return this->forward_profiles_->get_profile (0)->object_key (); 00234 } 00235 00236 // If no forwarded profiles, just use the base profile 00237 return this->base_profiles_.get_profile (0)->object_key (); 00238 } |
|
Accessor for getting the object proxy broker pointer. CORBA::Objects using this stub use this for standard calls like is_a; get_interface; etc... Definition at line 280 of file Stub.inl. References object_proxy_broker_.
00281 { 00282 return this->object_proxy_broker_; 00283 } |
|
Mutator for setting the object proxy broker pointer. CORBA::Objects using this stub will use this for standard calls like is_a; get_interface; etc... Definition at line 286 of file Stub.inl. References object_proxy_broker_. Referenced by CORBA::Object::_proxy_broker(), and CORBA::Object::proxy_broker().
00287 { 00288 this->object_proxy_broker_ = object_proxy_broker; 00289 } |
|
|
|
Return the cached value from the ORB_Core. This flag indicates whether the stub code should make use of the collocation opportunities that are available to the ORB. Definition at line 299 of file Stub.inl. References collocation_opt_. Referenced by TAO::Narrow_Utils< T >::unchecked_narrow().
00300 { 00301 return this->collocation_opt_; 00302 } |
|
|
returns a pointer to the profile_in_use object. This object retains ownership of this profile. Definition at line 49 of file Stub.inl. References profile_in_use_. Referenced by CORBA::Object::_key(), and TAO_Default_Endpoint_Selector::select_endpoint().
00050 { 00051 return this->profile_in_use_; 00052 } |
|
Return the Profile lock. This lock can be used at places where profiles need to be edited. Definition at line 20 of file Stub.inl. References profile_lock_ptr_.
00021 { 00022 return this->profile_lock_ptr_; 00023 } |
|
NON-THREAD-SAFE. Utility method which resets or initializes the base_profile list and forward flags. Definition at line 10 of file Stub.inl. References base_profiles_, TAO_MProfile::get_next(), profile_success_, TAO_MProfile::rewind(), and set_profile_in_use_i(). Referenced by base_profiles(), next_profile_i(), and reset_profiles_i().
00011 { 00012 this->base_profiles_.rewind (); 00013 this->profile_success_ = false; 00014 00015 this->set_profile_in_use_i (base_profiles_.get_next ()); 00016 } |
|
NOT THREAD-SAFE. Utility method which pops all forward profile lists and resets the forward_profiles_ pointer. Definition at line 26 of file Stub.inl. References forward_back_one(), and forward_profiles_. Referenced by add_forward_profiles(), base_profiles(), and reset_profiles_i().
00027 { 00028 while (this->forward_profiles_ != 0) 00029 this->forward_back_one (); 00030 } |
|
THREAD SAFE this method will reset the base profile list to reference the first profile and if there are anmy existing forward profiles they are reset. Definition at line 40 of file Stub.inl. References ACE_GUARD, and reset_profiles_i(). Referenced by TAO::Remote_Invocation::send_message(), TAO::Synch_Twoway_Invocation::wait_for_reply(), and ~TAO_Stub().
00041 { 00042 ACE_MT (ACE_GUARD (ACE_Lock, 00043 guard, 00044 *this->profile_lock_ptr_)); 00045 this->reset_profiles_i (); 00046 } |
|
NON-THREAD SAFE version of reset_profiles (void);.
Definition at line 33 of file Stub.inl. References reset_base(), and reset_forward(). Referenced by next_profile_retry(), and reset_profiles().
00034 { 00035 this->reset_forward (); 00036 this->reset_base (); 00037 } |
|
Accesor and mutator for the servant ORB. Notice that the mutator assumes the ownership of the passed in ORB and the accesor does not return a copy of the orb since the accessing of the ORB is considered temporary. Definition at line 262 of file Stub.inl. References CORBA::ORB::_duplicate(), CORBA::ORB_ptr, and servant_orb_. Referenced by set_policy_overrides().
00263 { 00264 this->servant_orb_ = CORBA::ORB::_duplicate (orb); 00265 } |
|
This returns a duplicated ORB pointer.
Definition at line 255 of file Stub.inl. References CORBA::ORB::_duplicate(). Referenced by TAO::Collocated_Invocation::invoke().
00256 { 00257 // Simply pass back the ORB pointer for temporary use. 00258 return CORBA::ORB::_duplicate (this->servant_orb_.in ()); 00259 } |
|
This returns the ORB var itself (generally for temporary use).
Definition at line 248 of file Stub.inl. References servant_orb_. Referenced by TAO_ORB_Core::collocation_strategy(), and TAO::Narrow_Utils< T >::unchecked_narrow().
00249 { 00250 // Simply pass back the ORB pointer for temporary use. 00251 return this->servant_orb_; 00252 } |
|
Definition at line 440 of file Stub.cpp. References base_profiles_, policies_, CORBA::PolicyList, ACE_Auto_Basic_Ptr< X >::release(), servant_orb(), and TAO_POLICY_OBJECT_SCOPE. Referenced by CORBA::Object::_set_policy_overrides().
00442 { 00443 // Notice the use of an explicit constructor.... 00444 auto_ptr<TAO_Policy_Set> policy_manager ( 00445 new TAO_Policy_Set (TAO_POLICY_OBJECT_SCOPE)); 00446 00447 if (set_add == CORBA::SET_OVERRIDE) 00448 { 00449 policy_manager->set_policy_overrides (policies, set_add); 00450 } 00451 else if (this->policies_ == 0) 00452 { 00453 policy_manager->set_policy_overrides (policies, CORBA::SET_OVERRIDE); 00454 } 00455 else 00456 { 00457 policy_manager->copy_from (this->policies_); 00458 00459 policy_manager->set_policy_overrides (policies, set_add); 00460 } 00461 00462 TAO_Stub* stub = this->orb_core_->create_stub (this->type_id.in (), 00463 this->base_profiles_); 00464 00465 stub->policies_ = policy_manager.release (); 00466 00467 // Copy the servant ORB if it is present. 00468 stub->servant_orb (this->servant_orb_var ().in ()); 00469 00470 return stub; 00471 } |
|
Makes a copy of the profile and frees the existing profile_in_use. NOT THREAD SAFE Definition at line 327 of file Stub.cpp. References TAO_Profile::_decr_refcnt(), TAO_Profile::_incr_refcnt(), ACE_ERROR_RETURN, ACE_TEXT, LM_ERROR, and profile_in_use_. Referenced by next_profile_i(), and reset_base().
00328 { 00329 TAO_Profile *const old = this->profile_in_use_; 00330 00331 // Since we are actively using this profile we dont want 00332 // it to disappear, so increase the reference count by one!! 00333 if (pfile && (pfile->_incr_refcnt () == 0)) 00334 { 00335 ACE_ERROR_RETURN ((LM_ERROR, 00336 ACE_TEXT ("(%P|%t) unable to increment profile ref!\n")), 00337 0); 00338 } 00339 00340 this->profile_in_use_ = pfile; 00341 00342 if (old) 00343 old->_decr_refcnt (); 00344 00345 return this->profile_in_use_; 00346 } |
|
NON-THREAD-SAFE. Will set profile_success_ to 0.
Definition at line 160 of file Stub.inl. References profile_success_. Referenced by TAO::Remote_Invocation::send_message().
00161 { 00162 this->profile_success_ = true; 00163 } |
|
Return the queueing strategy to be used in by the transport. Selection will be based on the SyncScope policies. Definition at line 305 of file Stub.inl. References Messaging::SyncScope. Referenced by TAO_Transport::check_buffering_constraints_i(), and TAO_Transport::send_asynchronous_message_i().
00306 { 00307 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) 00308 00309 bool has_synchronization; 00310 Messaging::SyncScope scope; 00311 00312 this->orb_core_->call_sync_scope_hook (this, has_synchronization, scope); 00313 00314 if (has_synchronization == true) 00315 return this->orb_core_->get_transport_queueing_strategy (this, scope); 00316 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */ 00317 00318 // No queueing strategy, let the transport use its default 00319 return 0; 00320 } |
|
Returns 1 if a forward profile has successfully been used. profile_success_ && forward_profiles_ Definition at line 154 of file Stub.inl. References forward_profiles_, and profile_success_.
00155 { 00156 return (this->profile_success_ && this->forward_profiles_); 00157 } |
|
Returns TRUE if a connection was successful with at least one profile. Definition at line 166 of file Stub.inl. References profile_success_.
00167 { 00168 return this->profile_success_; 00169 } |
|
Ordered list of profiles for this object.
Definition at line 362 of file Stub.h. Referenced by add_forward_profiles(), base_profiles(), create_ior_info(), forward_back_one(), hash(), make_profiles(), marshal(), next_profile_i(), object_key(), reset_base(), and set_policy_overrides(). |
|
Servant pointer. It is 0 except for collocated objects.
Definition at line 350 of file Stub.h. Referenced by collocated_servant(). |
|
This should be the same value as cached in the ORB_Core. The reason for caching this helps our generated code, notably the stubs to be decoubled from ORB_Core. Please do not move it away. Definition at line 408 of file Stub.h. Referenced by optimize_collocation_objects(). |
|
The list of forwarding profiles. This is actually implemented as a linked list of TAO_MProfile objects. Definition at line 366 of file Stub.h. Referenced by add_forward_profiles(), create_ior_info(), forward_back_one(), forward_profiles(), next_forward_profile(), next_profile_i(), next_profile_retry(), object_key(), reset_forward(), valid_forward_profile(), and ~TAO_Stub(). |
|
Definition at line 370 of file Stub.h. Referenced by add_forward_profiles(), marshal(), next_forward_profile(), and next_profile_i(). |
|
Forwarded IOR info.
Definition at line 399 of file Stub.h. Referenced by create_ior_info(), and ~TAO_Stub(). |
|
The ior info. This is needed for GIOP 1.2, as the clients could receive an exception from the server asking for this info. The exception that the client receives is LOC_NEEDS_ADDRESSING_MODE. The data is set up here to be passed on to Invocation classes when they receive an exception. This info is for the base profiles that this class stores Definition at line 396 of file Stub.h. Referenced by create_ior_info(), and ~TAO_Stub(). |
|
Flag that indicates that this stub is collocated (and that it belongs to an ORB for which collocation optimisation is active). Definition at line 338 of file Stub.h. Referenced by is_collocated(). |
|
Pointer to the Proxy Broker. This cached pointer instance takes care of routing the call for standard calls in CORBA::Object like _is_a (), _get_component () etc. Definition at line 358 of file Stub.h. Referenced by is_collocated(), and object_proxy_broker(). |
|
|
|
Automatically manage the ORB_Core reference count. The ORB_Core cannot go away until the object references it creates are destroyed. There are multiple reasons for this, but in particular, the allocators used for some of the TAO_Profile objects contained on each TAO_Stub are owned by the TAO_ORB_Core. This must be the first field of the class, otherwise the TAO_ORB_Core is destroyed too early! |
|
The policy overrides in this object, if nil then use the default policies. Definition at line 386 of file Stub.h. Referenced by get_cached_policy(), get_policy(), get_policy_overrides(), set_policy_overrides(), and ~TAO_Stub(). |
|
This is the profile that we are currently sending/receiving with.
Definition at line 373 of file Stub.h. Referenced by add_forward_profiles(), base_profiles(), create_ior_info(), is_equivalent(), object_key(), profile_in_use(), set_profile_in_use_i(), and ~TAO_Stub(). |
|
Mutex to protect access to the forwarding profile.
Definition at line 376 of file Stub.h. Referenced by profile_lock(), TAO_Stub(), and ~TAO_Stub(). |
|
Have we successfully talked to the forward profile yet?
Definition at line 379 of file Stub.h. Referenced by add_forward_profiles(), next_profile_i(), next_profile_retry(), reset_base(), set_valid_profile(), valid_forward_profile(), and valid_profile(). |
|
Reference counter.
|
|
If this stub refers to a collocated object then we need to hold on to the servant's ORB (which may be different from the client ORB) so that, 1. we know that the ORB will stay alive long enough, and, 2. we can search for the servant/POA's status starting from the ORB's RootPOA. Definition at line 347 of file Stub.h. Referenced by servant_orb(), and servant_orb_var(). |
|
All objref representations carry around a type ID.
Definition at line 96 of file Stub.h. Referenced by CORBA::Object::_is_a(). |