#include <Invocation_Adapter.h>
Collaboration diagram for TAO::Invocation_Adapter:

Public Member Functions | |
| Invocation_Adapter (CORBA::Object_ptr target, Argument **args, int arg_number, const char *operation, size_t op_len, Collocation_Proxy_Broker *cpb, TAO::Invocation_Type type=TAO_TWOWAY_INVOCATION, TAO::Invocation_Mode mode=TAO_SYNCHRONOUS_INVOCATION) | |
| virtual | ~Invocation_Adapter (void) |
| virtual void | invoke (TAO::Exception_Data *ex, unsigned long ex_count) |
| Invoke the target, and used by the generated code. | |
Protected Member Functions | |
| virtual void | invoke_i (TAO_Stub *stub, TAO_Operation_Details &details) |
| bool | get_timeout (TAO_Stub *stub, ACE_Time_Value &val) |
| TAO_Stub * | get_stub () const |
| Helper method that extracts TAO_Stub from the target object. | |
| void | object_forwarded (CORBA::Object_var &effective_target, TAO_Stub *stub, CORBA::Boolean permanent_forward) |
| void | set_response_flags (TAO_Stub *stub, TAO_Operation_Details &details) |
| Helper method to set the response flags within details. | |
Helper methods for making different types of invocations. | |
These methods useful for various types of invocations like SII, AMI, DII and DSI. All the subclasses implement these methods to get the right behaviour at their level. | |
| virtual Invocation_Status | invoke_remote_i (TAO_Stub *stub, TAO_Operation_Details &details, CORBA::Object_var &effective_target, ACE_Time_Value *&max_wait_time) |
| virtual Invocation_Status | invoke_collocated_i (TAO_Stub *stub, TAO_Operation_Details &details, CORBA::Object_var &effective_target, Collocation_Strategy strat) |
| Make a collocated call. | |
| virtual Invocation_Status | invoke_twoway (TAO_Operation_Details &details, CORBA::Object_var &effective_target, Profile_Transport_Resolver &r, ACE_Time_Value *&max_wait_time) |
| Helper method to make a two way invocation. | |
| virtual Invocation_Status | invoke_oneway (TAO_Operation_Details &details, CORBA::Object_var &effective_target, Profile_Transport_Resolver &r, ACE_Time_Value *&max_wait_time) |
| Helper method to make a one way invocation. | |
Protected Attributes | |
| CORBA::Object_ptr | target_ |
| The target object on which this invocation is carried out. | |
| Argument **const | args_ |
| Array of arguments for this operation. | |
| int const | number_args_ |
| Number of arguments for this operation. | |
| char const * | operation_ |
| Name of the operation. | |
| size_t const | op_len_ |
| String length of the operation name. | |
| Collocation_Proxy_Broker *const | cpb_ |
| Collocation proxy broker for this operation. | |
| Invocation_Type const | type_ |
| The invocation type. | |
| Invocation_Mode const | mode_ |
| The invocation mode. | |
Private Member Functions | |
| Invocation_Adapter (void) | |
| Dont allow default initializations. | |
| Invocation_Adapter (Invocation_Adapter const &) | |
| Invocation_Adapter & | operator= (const Invocation_Adapter &) |
The main objective of this class is to adapt the type and invocation specific information declared in the IDL by the application and convert them as CORBA invocations to the target object. Implementation of this class knows how to make invocations on a collocated or a remote object.
This adapter class serves as the base class for various types of invocations like AMI, DII, DSI etc. Adapter classes for AMI, DII, DSI inherit from this class and their local behavioural information before kicking off an invocation.
@ More info.. Wafer thin inclusions All stuff created on stack Only handles starts and restarts
Definition at line 80 of file Invocation_Adapter.h.
|
||||||||||||||||||||||||||||||||||||
|
|
|
|
Definition at line 28 of file Invocation_Adapter.cpp.
00029 {
00030 }
|
|
|
Dont allow default initializations.
|
|
|
|
|
|
Helper method that extracts TAO_Stub from the target object.
Definition at line 144 of file Invocation_Adapter.cpp. References CORBA::Object::_stubobj(), and ACE_THROW_RETURN. Referenced by invoke().
00145 {
00146 TAO_Stub * const stub =
00147 this->target_->_stubobj ();
00148
00149 if (stub == 0)
00150 ACE_THROW_RETURN (CORBA::INTERNAL (
00151 CORBA::SystemException::_tao_minor_code (
00152 TAO::VMCID,
00153 EINVAL),
00154 CORBA::COMPLETED_NO),
00155 stub);
00156
00157 return stub;
00158 }
|
|
||||||||||||
|
Helper function that extracts the roundtrip timeout policies set in the ORB. Definition at line 132 of file Invocation_Adapter.cpp. References TAO_ORB_Core::call_timeout_hook(), and CORBA::Object::orb_core(). Referenced by invoke_remote_i().
00134 {
00135 bool has_timeout = false;
00136 this->target_->orb_core ()->call_timeout_hook (stub,
00137 has_timeout,
00138 timeout);
00139
00140 return has_timeout;
00141 }
|
|
||||||||||||
|
Invoke the target, and used by the generated code. The implementation decides whether the target is remote or collocated and takes the right decision.
Definition at line 33 of file Invocation_Adapter.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, get_stub(), and invoke_i(). Referenced by TAO::Remote_Object_Proxy_Broker::_get_component(), TAO::Remote_Object_Proxy_Broker::_is_a(), TAO::Remote_Object_Proxy_Broker::_non_existent(), TAO::Remote_Object_Proxy_Broker::_repository_id(), CORBA::Policy::copy(), CORBA::Policy::destroy(), CORBA::DomainManager::get_domain_policy(), CORBA::ConstructionPolicy::make_domain_manager(), and TAO_CORBANAME_Parser::parse_string_dynamic_request_helper().
00036 {
00037 // Should stub object be refcounted here?
00038 TAO_Stub *stub =
00039 this->get_stub (ACE_ENV_SINGLE_ARG_PARAMETER);
00040 ACE_CHECK;
00041
00042 TAO_Operation_Details op_details (this->operation_,
00043 this->op_len_,
00044 this->number_args_ > 1,
00045 this->args_,
00046 this->number_args_,
00047 ex_data,
00048 ex_count);
00049
00050 this->invoke_i (stub,
00051 op_details
00052 ACE_ENV_ARG_PARAMETER);
00053 ACE_CHECK;
00054 }
|
|
||||||||||||||||||||
|
Make a collocated call. This method creates an object that takes care of making collocated invocations and calls invoke () on it. If the invoke () returns with a location forwarded reply we return a restart
Definition at line 161 of file Invocation_Adapter.cpp. References ACE_ASSERT, ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, cpb_, TAO_Pseudo_Var_T< T >::in(), TAO::Collocated_Invocation::invoke(), TAO::Invocation_Base::is_forwarded(), object_forwarded(), CORBA::Object_var, TAO::Invocation_Base::reply_status(), TAO::Invocation_Base::steal_forwarded_reference(), TAO::TAO_CS_THRU_POA_STRATEGY, TAO_GIOP_LOCATION_FORWARD_PERM, TAO::TAO_INVOKE_FAILURE, TAO::TAO_INVOKE_RESTART, TAO::TAO_INVOKE_START, and TAO::TAO_TWOWAY_INVOCATION. Referenced by invoke_i().
00166 {
00167 // To make a collocated call we must have a collocated proxy broker, the
00168 // invoke_i() will make sure that we only come here when we have one
00169 ACE_ASSERT (cpb_ != 0
00170 || (strat == TAO_CS_THRU_POA_STRATEGY
00171 && effective_target->_servant () != 0));
00172
00173 // Initial state
00174 TAO::Invocation_Status status = TAO_INVOKE_START;
00175
00176 Collocated_Invocation coll_inv (this->target_,
00177 effective_target.in (),
00178 stub,
00179 details,
00180 this->type_ == TAO_TWOWAY_INVOCATION);
00181
00182 status =
00183 coll_inv.invoke (this->cpb_,
00184 strat
00185 ACE_ENV_ARG_PARAMETER);
00186 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
00187
00188 if (status == TAO_INVOKE_RESTART &&
00189 coll_inv.is_forwarded ())
00190 {
00191 effective_target =
00192 coll_inv.steal_forwarded_reference ();
00193
00194 #if TAO_HAS_INTERCEPTORS == 1
00195 const bool is_permanent_forward =
00196 (coll_inv.reply_status() == TAO_GIOP_LOCATION_FORWARD_PERM);
00197 #else
00198 const bool is_permanent_forward = false;
00199 #endif
00200
00201 (void) this->object_forwarded (effective_target,
00202 stub,
00203 is_permanent_forward
00204 ACE_ENV_ARG_PARAMETER);
00205 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
00206 }
00207
00208 return status;
00209 }
|
|
||||||||||||
|
The stub pointer passed to this call has all the details about the object to which the invocation needs to be routed to. The implementation of this method looks if we are collocated or not and takes care of reinvoking the target if it receives forwarding information or if the first invocation fails for some reason, like a loss of connection during send () etc. Definition at line 57 of file Invocation_Adapter.cpp. References CORBA::Object::_duplicate(), ACE_CHECK, ACE_DEBUG, ACE_ENV_ARG_PARAMETER, TAO_ORB_Core::collocation_strategy(), TAO::Collocation_Strategy, cpb_, TAO_Pseudo_Var_T< T >::in(), invoke_collocated_i(), invoke_remote_i(), LM_DEBUG, CORBA::Object_var, set_response_flags(), TAO::TAO_CS_LAST, TAO::TAO_CS_REMOTE_STRATEGY, TAO::TAO_CS_THRU_POA_STRATEGY, TAO_debug_level, TAO::TAO_INVOKE_RESTART, and TAO::TAO_INVOKE_START. Referenced by invoke().
00060 {
00061 // Cache the target to a local variable.
00062 CORBA::Object_var effective_target =
00063 CORBA::Object::_duplicate (this->target_);
00064
00065 // Initial state
00066 TAO::Invocation_Status status = TAO_INVOKE_START;
00067
00068 ACE_Time_Value *max_wait_time = 0;
00069
00070 while (status == TAO_INVOKE_START ||
00071 status == TAO_INVOKE_RESTART)
00072 {
00073 // Default we go to remote
00074 Collocation_Strategy strat = TAO_CS_REMOTE_STRATEGY;
00075
00076 // If we have a collocated proxy broker we look if we maybe
00077 // can use a collocated invocation. Similarly, if the
00078 // target object reference contains a pointer to a servant,
00079 // the object reference also refers to a collocated object.
00080 if (cpb_ != 0 || effective_target->_servant () != 0)
00081 {
00082 strat =
00083 TAO_ORB_Core::collocation_strategy (effective_target.in ()
00084 ACE_ENV_ARG_PARAMETER);
00085 ACE_CHECK;
00086 }
00087
00088 if (strat == TAO_CS_REMOTE_STRATEGY ||
00089 strat == TAO_CS_LAST)
00090 {
00091 status =
00092 this->invoke_remote_i (stub,
00093 details,
00094 effective_target,
00095 max_wait_time
00096 ACE_ENV_ARG_PARAMETER);
00097 ACE_CHECK;
00098 }
00099 else
00100 {
00101 if (strat == TAO_CS_THRU_POA_STRATEGY)
00102 {
00103 (void) this->set_response_flags (stub,
00104 details);
00105 }
00106
00107 status =
00108 this->invoke_collocated_i (stub,
00109 details,
00110 effective_target,
00111 strat
00112 ACE_ENV_ARG_PARAMETER);
00113 ACE_CHECK;
00114 }
00115
00116 if (status == TAO_INVOKE_RESTART)
00117 {
00118 details.reset_request_service_info ();
00119 details.reset_reply_service_info ();
00120
00121 if (TAO_debug_level > 2)
00122 {
00123 ACE_DEBUG ((LM_DEBUG,
00124 "TAO (%P|%t) - Invocation_Adapter::invoke_i, "
00125 "handling forwarded locations \n"));
00126 }
00127 }
00128 }
00129 }
|
|
||||||||||||||||||||
|
Helper method to make a one way invocation. This method creates a synchronous oneway invocation object to which the actual task of request handling is delegated. Once the invocation returns this method checks whether the request is forwarded to a new location to take appropriate action. Definition at line 351 of file Invocation_Adapter.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, TAO::Invocation_Status, TAO::Invocation_Base::is_forwarded(), object_forwarded(), CORBA::Object_var, TAO::Synch_Oneway_Invocation::remote_oneway(), TAO::Invocation_Base::reply_status(), TAO::Invocation_Base::steal_forwarded_reference(), TAO::Profile_Transport_Resolver::stub(), TAO_GIOP_LOCATION_FORWARD_PERM, TAO::TAO_INVOKE_FAILURE, and TAO::TAO_INVOKE_RESTART. Referenced by invoke_remote_i().
00356 {
00357 TAO::Synch_Oneway_Invocation synch (this->target_,
00358 r,
00359 details);
00360
00361 Invocation_Status s =
00362 synch.remote_oneway (max_wait_time
00363 ACE_ENV_ARG_PARAMETER);
00364 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
00365
00366 if (s == TAO_INVOKE_RESTART &&
00367 synch.is_forwarded ())
00368 {
00369 effective_target =
00370 synch.steal_forwarded_reference ();
00371
00372 #if TAO_HAS_INTERCEPTORS == 1
00373 const bool is_permanent_forward =
00374 (synch.reply_status() == TAO_GIOP_LOCATION_FORWARD_PERM);
00375 #else
00376 const bool is_permanent_forward = false;
00377 #endif
00378 this->object_forwarded (effective_target,
00379 r.stub (),
00380 is_permanent_forward
00381 ACE_ENV_ARG_PARAMETER);
00382 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
00383 }
00384
00385 return s;
00386 }
|
|
||||||||||||||||||||
|
Helper method that prepares the necessary stuff for a remote invocation. Definition at line 248 of file Invocation_Adapter.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, get_timeout(), TAO_Pseudo_Var_T< T >::in(), invoke_oneway(), invoke_twoway(), CORBA::Object_var, TAO_Transport_Mux_Strategy::request_id(), TAO_Operation_Details::request_id(), TAO::Profile_Transport_Resolver::resolve(), TAO_Operation_Details::response_flags(), set_response_flags(), TAO::TAO_INVOKE_FAILURE, TAO::TAO_ONEWAY_INVOCATION, TAO::TAO_TWOWAY_INVOCATION, TAO_Transport::tms(), and TAO::Profile_Transport_Resolver::transport(). Referenced by invoke_i().
00253 {
00254 ACE_Time_Value tmp_wait_time;
00255 bool is_timeout =
00256 this->get_timeout (stub,
00257 tmp_wait_time);
00258
00259 if (is_timeout)
00260 max_wait_time = &tmp_wait_time;
00261
00262 (void) this->set_response_flags (stub,
00263 details);
00264
00265 // Create the resolver which will pick (or create) for us a
00266 // transport and a profile from the effective_target.
00267 Profile_Transport_Resolver resolver (
00268 effective_target.in (),
00269 stub,
00270 (details.response_flags () != Messaging::SYNC_NONE));
00271
00272 resolver.resolve (max_wait_time
00273 ACE_ENV_ARG_PARAMETER);
00274 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
00275
00276 // Update the request id now that we have a transport
00277 details.request_id (resolver.transport ()->tms ()->request_id ());
00278
00279 if (this->type_ == TAO_ONEWAY_INVOCATION)
00280 {
00281 return this->invoke_oneway (details,
00282 effective_target,
00283 resolver,
00284 max_wait_time
00285 ACE_ENV_ARG_PARAMETER);
00286 }
00287 else if (this->type_ == TAO_TWOWAY_INVOCATION)
00288 {
00289 return this->invoke_twoway (details,
00290 effective_target,
00291 resolver,
00292 max_wait_time
00293 ACE_ENV_ARG_PARAMETER);
00294 }
00295
00296 return TAO_INVOKE_FAILURE;
00297 }
|
|
||||||||||||||||||||
|
Helper method to make a two way invocation. This method creates a synchronous twoway invocation object to which the actual task of request handling is delegated. Once the invocation returns this method checks whether the request is forwarded to a new location. Definition at line 300 of file Invocation_Adapter.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, TAO::Invocation_Status, TAO::Invocation_Base::is_forwarded(), object_forwarded(), CORBA::Object_var, TAO::Synch_Twoway_Invocation::remote_twoway(), TAO::Invocation_Base::reply_status(), TAO::Invocation_Base::steal_forwarded_reference(), TAO::Profile_Transport_Resolver::stub(), TAO_GIOP_LOCATION_FORWARD_PERM, TAO::TAO_INVOKE_FAILURE, TAO::TAO_INVOKE_RESTART, TAO::TAO_SYNCHRONOUS_INVOCATION, and TAO::TAO_TWOWAY_INVOCATION. Referenced by invoke_remote_i().
00305 {
00306 // Simple sanity check
00307 if (this->mode_ != TAO_SYNCHRONOUS_INVOCATION ||
00308 this->type_ != TAO_TWOWAY_INVOCATION)
00309 {
00310 ACE_THROW_RETURN (CORBA::INTERNAL (
00311 CORBA::SystemException::_tao_minor_code (
00312 TAO::VMCID,
00313 EINVAL),
00314 CORBA::COMPLETED_NO),
00315 TAO_INVOKE_FAILURE);
00316 }
00317
00318 TAO::Synch_Twoway_Invocation synch (this->target_,
00319 r,
00320 details);
00321
00322 Invocation_Status status =
00323 synch.remote_twoway (max_wait_time
00324 ACE_ENV_ARG_PARAMETER);
00325 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
00326
00327 if (status == TAO_INVOKE_RESTART &&
00328 synch.is_forwarded ())
00329 {
00330 effective_target =
00331 synch.steal_forwarded_reference ();
00332
00333 #if TAO_HAS_INTERCEPTORS == 1
00334 const bool is_permanent_forward =
00335 (synch.reply_status() == TAO_GIOP_LOCATION_FORWARD_PERM);
00336 #else
00337 const bool is_permanent_forward = false;
00338 #endif
00339
00340 this->object_forwarded (effective_target,
00341 r.stub (),
00342 is_permanent_forward
00343 ACE_ENV_ARG_PARAMETER);
00344 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
00345 }
00346
00347 return status;
00348 }
|
|
||||||||||||||||
|
Helper method that takes care of setting the profiles within the stub object if the target gets forwarded Definition at line 389 of file Invocation_Adapter.cpp. References ACE_THROW, TAO_Stub::add_forward_profiles(), TAO_Stub::base_profiles(), TAO_Stub::next_profile(), CORBA::Object_var, and TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE. Referenced by invoke_collocated_i(), invoke_oneway(), and invoke_twoway().
00393 {
00394 // The object pointer has to be changed to a TAO_Stub pointer
00395 // in order to obtain the profiles.
00396 TAO_Stub *stubobj =
00397 effective_target->_stubobj ();
00398
00399 if (stubobj == 0)
00400 ACE_THROW (CORBA::INTERNAL (
00401 CORBA::SystemException::_tao_minor_code (
00402 TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
00403 errno),
00404 CORBA::COMPLETED_NO));
00405
00406
00407 // Reset the profile in the stubs
00408 stub->add_forward_profiles (stubobj->base_profiles (), permanent_forward);
00409
00410 if (stub->next_profile () == 0)
00411 ACE_THROW (CORBA::TRANSIENT (
00412 CORBA::SystemException::_tao_minor_code (
00413 TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
00414 errno),
00415 CORBA::COMPLETED_NO));
00416
00417 return;
00418 }
|
|
|
|
|
||||||||||||
|
Helper method to set the response flags within details.
Definition at line 212 of file Invocation_Adapter.cpp. References TAO_ORB_Core::call_sync_scope_hook(), TAO_Stub::orb_core(), TAO_Operation_Details::response_flags(), Messaging::SyncScope, TAO::TAO_ONEWAY_INVOCATION, TAO::TAO_TWOWAY_INVOCATION, and TAO_TWOWAY_RESPONSE_FLAG. Referenced by invoke_i(), and invoke_remote_i().
00215 {
00216 switch (this->type_)
00217 {
00218 case TAO_ONEWAY_INVOCATION:
00219 {
00220 // Grab the syncscope policy from the ORB.
00221 Messaging::SyncScope sync_scope;
00222
00223 bool has_synchronization = false;
00224
00225 stub->orb_core ()->call_sync_scope_hook (stub,
00226 has_synchronization,
00227 sync_scope);
00228 if (has_synchronization)
00229 details.response_flags (CORBA::Octet (sync_scope));
00230 else
00231 details.response_flags (
00232 CORBA::Octet (Messaging::SYNC_WITH_TRANSPORT));
00233 break;
00234 }
00235 case TAO_TWOWAY_INVOCATION:
00236 {
00237 // @@note: Need to change this to something better. Too many
00238 // hash defines meaning the same things.
00239 details.response_flags (TAO_TWOWAY_RESPONSE_FLAG);
00240 break;
00241 }
00242 }
00243
00244 return;
00245 }
|
|
|
Array of arguments for this operation.
Definition at line 260 of file Invocation_Adapter.h. |
|
|
Collocation proxy broker for this operation.
Definition at line 275 of file Invocation_Adapter.h. Referenced by invoke_collocated_i(), and invoke_i(). |
|
|
The invocation mode.
Definition at line 281 of file Invocation_Adapter.h. |
|
|
Number of arguments for this operation. This includes the return values too Definition at line 266 of file Invocation_Adapter.h. |
|
|
String length of the operation name.
Definition at line 272 of file Invocation_Adapter.h. |
|
|
Name of the operation.
Definition at line 269 of file Invocation_Adapter.h. |
|
|
The target object on which this invocation is carried out.
Definition at line 257 of file Invocation_Adapter.h. |
|
|
The invocation type.
Definition at line 278 of file Invocation_Adapter.h. |
1.3.6