#include <Profile_Transport_Resolver.h>
Collaboration diagram for TAO::Profile_Transport_Resolver:
Public Member Functions | |
Profile_Transport_Resolver (CORBA::Object *p, TAO_Stub *stub, bool block=true) | |
Constructor. | |
~Profile_Transport_Resolver (void) | |
void | resolve (ACE_Time_Value *val) throw (CORBA::SystemException) |
Method where the bunch of the action takes place. | |
void | transport_released (void) const |
bool | try_connect (TAO_Transport_Descriptor_Interface *desc, ACE_Time_Value *val) |
bool | try_parallel_connect (TAO_Transport_Descriptor_Interface *desc, ACE_Time_Value *val) |
bool | use_parallel_connect (void) const |
void | init_inconsistent_policies () throw (CORBA::SystemException) |
CORBA::PolicyList * | inconsistent_policies (void) const |
CORBA::PolicyList * | steal_inconsistent_policies (void) |
Accessors and mutators for this class. The following methods | |
are used by the clients of this class to access strategies and other internal workings. | |
void | profile (TAO_Profile *pfile) |
Mutator for profile. | |
TAO_Profile * | profile (void) const |
Accessor for profile. | |
TAO_Stub * | stub (void) const |
Accessor for TAO_Stub. | |
CORBA::Object * | object (void) const |
Accessor for the target in use. | |
TAO_Transport * | transport (void) const |
Accessor for the transport reserved for this invocation. | |
int | find_transport (TAO_Transport_Descriptor_Interface *) |
bool | blocked_connect (void) const |
Private Member Functions | |
bool | get_connection_timeout (ACE_Time_Value &max_wait_time) |
bool | try_connect_i (TAO_Transport_Descriptor_Interface *desc, ACE_Time_Value *val, bool parallel) |
Private Attributes | |
CORBA::Object * | obj_ |
Target object. | |
TAO_Stub * | stub_ |
Stub object for the target object. | |
TAO_Transport * | transport_ |
The transport selected for this invocation. | |
TAO_Profile * | profile_ |
The profile that has been selected for this invocation. | |
CORBA::PolicyList * | inconsistent_policies_ |
List of inconsistent policies. | |
bool | is_released_ |
Has the transport been idle? | |
bool const | blocked_ |
Should we block while trying to make a connection. |
A target object is represented by multiple profiles, which theoretically provides multiple paths to the same target object. This class helps in choosing the right profile, and pick a transport from cache (or create a new transport if needed) that represents the profile.
Definition at line 66 of file Profile_Transport_Resolver.h.
|
Constructor. With block we tell whether this resolved should always deliver a connection by blocking or unblock before the connection is completely established. Please note that this has *nothing* to do with the synchronous or asynch connect strategy used for making connections. This is a local flag used by the clients of this to dictate some local behavior. Definition at line 11 of file Profile_Transport_Resolver.inl.
00015 : obj_ (p) 00016 , stub_ (stub) 00017 , transport_ (0) 00018 , profile_ (0) 00019 , inconsistent_policies_ (0) 00020 , is_released_ (false) 00021 , blocked_ (block) 00022 { 00023 } |
|
Definition at line 35 of file Profile_Transport_Resolver.cpp. References TAO_Profile::_decr_refcnt(), inconsistent_policies_, is_released_, TAO_Transport::make_idle(), and TAO_Transport::remove_reference().
00036 { 00037 if (this->profile_) 00038 { 00039 this->profile_->_decr_refcnt (); 00040 } 00041 00042 if (this->transport_) 00043 { 00044 if (this->is_released_ == false) 00045 { 00046 this->transport_->make_idle (); 00047 } 00048 00049 this->transport_->remove_reference (); 00050 } 00051 00052 delete this->inconsistent_policies_; 00053 } |
|
Accessor to indicate whether we should block while establishing a connection. Definition at line 50 of file Profile_Transport_Resolver.inl. References blocked_. Referenced by TAO_IIOP_Connector::begin_connection(), TAO_Default_Endpoint_Selector::select_endpoint(), and TAO_Connector::wait_for_connection_completion().
00051 { 00052 return this->blocked_; 00053 } |
|
See if the transport cache has an available transport and use that one rather than trying to connect via the connector. Separating this functionality enables the look up of many endpoints before trying the more time-consuming trip through the actual connector. Definition at line 264 of file Profile_Transport_Resolver.cpp. References TAO::Transport_Cache_Manager::find_transport(), TAO_ORB_Core::lane_resources(), TAO_Profile::orb_core(), and TAO_Thread_Lane_Resources::transport_cache().
00265 { 00266 TAO::Transport_Cache_Manager & cache = 00267 this->profile_->orb_core()->lane_resources ().transport_cache(); 00268 00269 // the cache increments the reference count on the transport if the 00270 // find is successful. Find_transport uses negative logic in its return, 00271 // 0 for success 00272 return (cache.find_transport(desc,this->transport_) == 0); 00273 } |
|
Helper method to access get the connection timeout from the ORB. Definition at line 234 of file Profile_Transport_Resolver.cpp. References TAO_ORB_Core::connection_timeout(), and TAO_Stub::orb_core(). Referenced by try_connect_i().
00236 { 00237 bool is_conn_timeout = false; 00238 00239 // Check for the connection timout policy in the ORB 00240 this->stub_->orb_core ()->connection_timeout (this->stub_, 00241 is_conn_timeout, 00242 max_wait_time); 00243 00244 return is_conn_timeout; 00245 } |
|
Definition at line 62 of file Profile_Transport_Resolver.inl. References inconsistent_policies_.
00063 { 00064 return this->inconsistent_policies_; 00065 } |
|
Initialize the inconsistent policy list that this object has cached. Definition at line 249 of file Profile_Transport_Resolver.cpp. References ACE_NEW_THROW_EX. Referenced by TAO::LocateRequest_Invocation_Adapter::invoke().
00252 { 00253 ACE_NEW_THROW_EX (this->inconsistent_policies_, 00254 CORBA::PolicyList (0), 00255 CORBA::NO_MEMORY ( 00256 CORBA::SystemException::_tao_minor_code ( 00257 0, 00258 ENOMEM), 00259 CORBA::COMPLETED_NO)); 00260 } |
|
Accessor for the target in use.
Definition at line 32 of file Profile_Transport_Resolver.inl.
00033 { 00034 return this->obj_; 00035 } |
|
Accessor for profile.
Definition at line 38 of file Profile_Transport_Resolver.inl.
00039 { 00040 return this->profile_; 00041 } |
|
Mutator for profile.
Definition at line 56 of file Profile_Transport_Resolver.cpp. References TAO_Profile::_decr_refcnt(), and TAO_Profile::_incr_refcnt(). Referenced by TAO::LocateRequest_Invocation::check_reply(), TAO::Synch_Twoway_Invocation::check_reply_status(), TAO::Remote_Invocation::init_target_spec(), and TAO_Default_Endpoint_Selector::select_endpoint().
00057 { 00058 // Dont do anything if the incoming profile is null 00059 if (p) 00060 { 00061 // @note This is just a workaround for a more serious problem 00062 // with profile management. This would cover some potential 00063 // issues that Ossama is working on. Ossama, please remove 00064 // them when you are done. 00065 TAO_Profile *tmp = this->profile_; 00066 00067 (void) p->_incr_refcnt (); 00068 this->profile_ = p; 00069 00070 if (tmp) 00071 { 00072 (void) tmp->_decr_refcnt (); 00073 } 00074 } 00075 } |
|
Method where the bunch of the action takes place. This is the entry point from the TAO::Invocation_Adapter class. This method accesses the endpoint selector factory from the ORB_Core to decide on the strategy to be used for selecting the profile. Definition at line 79 of file Profile_Transport_Resolver.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_THROW, TAO_GIOP_Message_Version::major, TAO_GIOP_Message_Version::minor, TAO_Invocation_Endpoint_Selector::select_endpoint(), and TAO_Codeset_Manager::set_tcs(). Referenced by TAO::LocateRequest_Invocation_Adapter::invoke(), and TAO::Invocation_Adapter::invoke_remote_i().
00082 { 00083 ACE_Countdown_Time countdown (max_time_val); 00084 00085 TAO_Invocation_Endpoint_Selector *es = 00086 this->stub_->orb_core ()->endpoint_selector_factory ()->get_selector ( 00087 ACE_ENV_SINGLE_ARG_PARAMETER); 00088 ACE_CHECK; 00089 00090 // Select the endpoint 00091 es->select_endpoint (this, 00092 max_time_val 00093 ACE_ENV_ARG_PARAMETER); 00094 ACE_CHECK; 00095 00096 if (this->transport_ == 0) 00097 { 00098 ACE_THROW (CORBA::INTERNAL ()); 00099 } 00100 00101 const TAO_GIOP_Message_Version& version = 00102 this->profile_->version (); 00103 00104 // Initialize the messaging object 00105 if (this->transport_->messaging_init (version.major, version.minor) == -1) 00106 { 00107 ACE_THROW (CORBA::INTERNAL ( 00108 CORBA::SystemException::_tao_minor_code ( 00109 0, 00110 EINVAL), 00111 CORBA::COMPLETED_NO)); 00112 } 00113 00114 if (!this->transport_->is_tcs_set ()) 00115 { 00116 TAO_Codeset_Manager * const tcm = 00117 this->stub_->orb_core ()->codeset_manager (); 00118 if (tcm) 00119 tcm->set_tcs (*this->profile_, *this->transport_); 00120 } 00121 } |
|
Definition at line 68 of file Profile_Transport_Resolver.inl. References inconsistent_policies_. Referenced by TAO::LocateRequest_Invocation_Adapter::invoke().
00069 { 00070 CORBA::PolicyList *tmp = this->inconsistent_policies_; 00071 this->inconsistent_policies_ = 0; 00072 return tmp; 00073 } |
|
Accessor for TAO_Stub.
Definition at line 26 of file Profile_Transport_Resolver.inl. Referenced by TAO::Remote_Invocation::init_target_spec(), TAO::Invocation_Adapter::invoke_oneway(), TAO::Invocation_Adapter::invoke_twoway(), TAO_Default_Endpoint_Selector::select_endpoint(), and TAO::Remote_Invocation::send_message().
00027 { 00028 return this->stub_; 00029 } |
|
Accessor for the transport reserved for this invocation.
Definition at line 44 of file Profile_Transport_Resolver.inl. Referenced by TAO::LocateRequest_Invocation::check_reply(), TAO::Synch_Twoway_Invocation::check_reply_status(), TAO::LocateRequest_Invocation_Adapter::invoke(), TAO::Invocation_Adapter::invoke_remote_i(), TAO::Remote_Invocation::send_message(), and TAO::Remote_Invocation::write_header().
00045 { 00046 return this->transport_; 00047 } |
|
Signal to let the resolver know that the transport has been released back to the cache. Definition at line 56 of file Profile_Transport_Resolver.inl. References is_released_.
00057 { 00058 this->is_released_ = true; 00059 } |
|
This is a callback method used by the endpoint selectors to delegate the responsibility of reserving a transport from the connection cache for this invocation. When the descriptor contains more than one endpoint (as part of a linked list) and the parallel flag is true then the connector will look for a connection on any of the endpoints if it supports that behavior, otherwise an ENOTSUP errno will be set and the method will return false. Definition at line 124 of file Profile_Transport_Resolver.cpp. References ACE_ENV_ARG_PARAMETER, and try_connect_i(). Referenced by TAO_Default_Endpoint_Selector::select_endpoint().
00129 { 00130 return this->try_connect_i (desc,max_time_value,0 ACE_ENV_ARG_PARAMETER); 00131 } |
|
Definition at line 145 of file Profile_Transport_Resolver.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_THROW_RETURN, TAO_ORB_Core::connector_registry(), TAO_Transport_Descriptor_Interface::endpoint(), ETIME, get_connection_timeout(), TAO_Connector_Registry::get_connector(), TAO_Stub::orb_core(), TAO_Endpoint::tag(), and TAO_TIMEOUT_CONNECT_MINOR_CODE. Referenced by try_connect(), and try_parallel_connect().
00151 { 00152 TAO_Connector_Registry *conn_reg = 00153 this->stub_->orb_core ()->connector_registry ( 00154 ACE_ENV_SINGLE_ARG_PARAMETER); 00155 ACE_CHECK_RETURN (false); 00156 00157 if (conn_reg == 0) 00158 { 00159 ACE_THROW_RETURN (CORBA::INTERNAL ( 00160 CORBA::SystemException::_tao_minor_code ( 00161 0, 00162 EINVAL), 00163 CORBA::COMPLETED_NO), 00164 false); 00165 } 00166 00167 ACE_Time_Value connection_timeout; 00168 00169 bool const is_conn_timeout = 00170 this->get_connection_timeout (connection_timeout); 00171 00172 ACE_Time_Value *max_wait_time = 00173 is_conn_timeout ? &connection_timeout : max_time_value; 00174 00175 if (parallel) 00176 { 00177 this->transport_ = 00178 conn_reg->get_connector (desc->endpoint ()->tag ())-> 00179 parallel_connect (this, 00180 desc, 00181 max_wait_time 00182 ACE_ENV_ARG_PARAMETER); 00183 ACE_CHECK_RETURN (false); 00184 } 00185 else 00186 { 00187 // Obtain a connection. 00188 this->transport_ = 00189 conn_reg->get_connector (desc->endpoint ()->tag ())-> 00190 connect (this, 00191 desc, 00192 max_wait_time 00193 ACE_ENV_ARG_PARAMETER); 00194 ACE_CHECK_RETURN (false); 00195 } 00196 // A timeout error occurred. 00197 // If the user has set a roundtrip timeout policy, throw a timeout 00198 // exception. Otherwise, just fall through and return false to 00199 // look at the next endpoint. 00200 if (this->transport_ == 0 00201 && is_conn_timeout == false 00202 && errno == ETIME) 00203 { 00204 ACE_THROW_RETURN (CORBA::TIMEOUT ( 00205 CORBA::SystemException::_tao_minor_code ( 00206 TAO_TIMEOUT_CONNECT_MINOR_CODE, 00207 errno), 00208 CORBA::COMPLETED_NO), 00209 false); 00210 } 00211 else if (this->transport_ == 0) 00212 { 00213 return false; 00214 } 00215 00216 return true; 00217 } |
|
Definition at line 134 of file Profile_Transport_Resolver.cpp. References ACE_ENV_ARG_PARAMETER, and try_connect_i(). Referenced by TAO_Default_Endpoint_Selector::select_endpoint().
00139 { 00140 return this->try_connect_i (desc,max_time_value,1 ACE_ENV_ARG_PARAMETER); 00141 } |
|
This method wraps a call to the orb core to see if parallel connection attempts are even desired. This is controlled by the -ORBUseParallelConnects 1|0 commandline option. Definition at line 220 of file Profile_Transport_Resolver.cpp. References TAO_ORB_Core::client_factory(), TAO_Client_Strategy_Factory::connect_strategy(), TAO_Stub::orb_core(), TAO_ORB_Core::orb_params(), and TAO_ORB_Parameters::use_parallel_connects(). Referenced by TAO_Default_Endpoint_Selector::select_endpoint().
00221 { 00222 TAO_ORB_Core *oc = this->stub_->orb_core(); 00223 return (oc->orb_params()->use_parallel_connects() 00224 #if 0 // it was decided that even with blocked connects 00225 // parallel connects could be useful, at least for cache 00226 // processing. 00227 oc->client_factory()->connect_strategy() != 00228 TAO_Client_Strategy_Factory::TAO_BLOCKED_CONNECT 00229 #endif /* 0 */ 00230 ); 00231 } |
|
Should we block while trying to make a connection.
Definition at line 210 of file Profile_Transport_Resolver.h. Referenced by blocked_connect(). |
|
List of inconsistent policies. If current effective policies cause the invocation to raise CORBA::INV_POLICY exception, the conflicting/problematic policies are stored in this list. This is used by
Definition at line 204 of file Profile_Transport_Resolver.h. Referenced by inconsistent_policies(), steal_inconsistent_policies(), and ~Profile_Transport_Resolver(). |
|
Has the transport been idle?
Definition at line 207 of file Profile_Transport_Resolver.h. Referenced by transport_released(), and ~Profile_Transport_Resolver(). |
|
Target object.
Definition at line 175 of file Profile_Transport_Resolver.h. |
|
The profile that has been selected for this invocation.
Definition at line 184 of file Profile_Transport_Resolver.h. |
|
Stub object for the target object.
Definition at line 178 of file Profile_Transport_Resolver.h. |
|
The transport selected for this invocation.
Definition at line 181 of file Profile_Transport_Resolver.h. |