#include <LocateRequest_Invocation_Adapter.h>
Collaboration diagram for TAO::LocateRequest_Invocation_Adapter:
Public Member Functions | |
LocateRequest_Invocation_Adapter (CORBA::Object_ptr target) | |
void | invoke (void) |
Start the invocation on the target. | |
CORBA::PolicyList * | get_inconsistent_policies (void) |
Accessor to the inconsistent policy list. | |
Private Member Functions | |
bool | get_timeout (ACE_Time_Value &val) |
void | object_forwarded (CORBA::Object_var &effective_target, TAO_Stub *stub, CORBA::Boolean permanent_forward) |
Private Attributes | |
CORBA::Object_ptr | target_ |
CORBA::PolicyList_var | list_ |
This class provides a look and feel similar to the TAO::Invocation_Adapter though the functionalities are different. For the record, IDL compiler doesn't know the existence of this class. This class is concerned with the creation and invocation of locate request invocations to the target object
Definition at line 58 of file LocateRequest_Invocation_Adapter.h.
TAO::LocateRequest_Invocation_Adapter::LocateRequest_Invocation_Adapter | ( | CORBA::Object_ptr | target | ) |
CORBA::PolicyList * TAO::LocateRequest_Invocation_Adapter::get_inconsistent_policies | ( | void | ) |
Accessor to the inconsistent policy list.
Definition at line 108 of file LocateRequest_Invocation_Adapter.cpp.
References list_.
00109 { 00110 return this->list_._retn (); 00111 }
bool TAO::LocateRequest_Invocation_Adapter::get_timeout | ( | ACE_Time_Value & | val | ) | [private] |
Definition at line 114 of file LocateRequest_Invocation_Adapter.cpp.
References TAO_ORB_Core::call_timeout_hook(), CORBA::Object::orb_core(), and target_.
00115 { 00116 bool has_timeout = false; 00117 this->target_->orb_core ()->call_timeout_hook (this->target_->_stubobj (), 00118 has_timeout, 00119 timeout); 00120 00121 return has_timeout; 00122 }
void TAO::LocateRequest_Invocation_Adapter::invoke | ( | void | ) |
Start the invocation on the target.
Definition at line 29 of file LocateRequest_Invocation_Adapter.cpp.
References CORBA::Object::_duplicate(), CORBA::Object::_stubobj(), CORBA::SystemException::_tao_minor_code(), CORBA::COMPLETED_NO, TAO_ORB_Core::configuration(), TAO_Pseudo_Var_T< T >::in(), list_, object_forwarded(), CORBA::OMGVMCID, TAO_Stub::orb_core(), TAO_Operation_Details::request_id(), TAO::TAO_INVOKE_RESTART, TAO::TAO_INVOKE_START, and target_.
00030 { 00031 CORBA::Object_var effective_target = 00032 CORBA::Object::_duplicate (this->target_); 00033 00034 TAO_Stub * const stub = 00035 this->target_->_stubobj (); 00036 if (stub == 0) 00037 throw ::CORBA::INTERNAL ( 00038 CORBA::SystemException::_tao_minor_code ( 00039 0, 00040 EINVAL), 00041 CORBA::COMPLETED_NO); 00042 00043 // The invocation has got to be within the context of the 00044 // corresponding ORB's configuration. Otherwise things like 00045 // timeout hooks, etc may not work as expected. Especially if 00046 // there are multiple ORB instances in the process, each with its 00047 // own, local configuration. 00048 ACE_Service_Config_Guard scg (stub->orb_core ()->configuration ()); 00049 00050 ACE_Time_Value tmp_wait_time; 00051 ACE_Time_Value *max_wait_time = 0; 00052 00053 if (this->get_timeout (tmp_wait_time)) 00054 max_wait_time = &tmp_wait_time; 00055 00056 Invocation_Status s = TAO_INVOKE_START; 00057 00058 while (s == TAO_INVOKE_START || 00059 s == TAO_INVOKE_RESTART) 00060 { 00061 Profile_Transport_Resolver resolver (effective_target.in (), stub, true); 00062 00063 try 00064 { 00065 resolver.init_inconsistent_policies (); 00066 00067 resolver.resolve (max_wait_time); 00068 00069 if (!resolver.transport ()) 00070 { 00071 // We failed to find a profile we could connect to. 00072 throw CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); 00073 } 00074 00075 // Dummy operation details that is used to instantiate the 00076 // LocateRequest class. 00077 TAO_Operation_Details op (0, 0); 00078 00079 op.request_id (resolver.transport ()->tms ()->request_id ()); 00080 TAO::LocateRequest_Invocation synch (this->target_, resolver, op); 00081 00082 s = synch.invoke (max_wait_time); 00083 if (s == TAO_INVOKE_RESTART && 00084 (synch.reply_status () == GIOP::LOCATION_FORWARD || 00085 synch.reply_status () == GIOP::LOCATION_FORWARD_PERM)) 00086 { 00087 CORBA::Boolean const is_permanent_forward = 00088 (synch.reply_status () == GIOP::LOCATION_FORWARD_PERM); 00089 00090 effective_target = synch.steal_forwarded_reference (); 00091 00092 this->object_forwarded (effective_target, 00093 resolver.stub (), 00094 is_permanent_forward); 00095 } 00096 } 00097 catch (const ::CORBA::INV_POLICY&) 00098 { 00099 this->list_ = resolver.steal_inconsistent_policies (); 00100 throw; 00101 } 00102 } 00103 00104 return; 00105 }
void TAO::LocateRequest_Invocation_Adapter::object_forwarded | ( | CORBA::Object_var & | effective_target, | |
TAO_Stub * | stub, | |||
CORBA::Boolean | permanent_forward | |||
) | [private] |
Helper method that takes care of setting the profiles within the stub object if the target gets forwarded
Definition at line 125 of file LocateRequest_Invocation_Adapter.cpp.
References CORBA::SystemException::_tao_minor_code(), TAO_Stub::add_forward_profiles(), TAO_Stub::base_profiles(), CORBA::COMPLETED_NO, TAO_Pseudo_Var_T< T >::in(), CORBA::is_nil(), TAO_Stub::next_profile(), TAO_MProfile::size(), and TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE.
Referenced by invoke().
00129 { 00130 // The object pointer has to be changed to a TAO_Stub pointer 00131 // in order to obtain the profiles. 00132 TAO_Stub *stubobj = 0; 00133 00134 bool nil_forward_ref = false; 00135 if (CORBA::is_nil (effective_target.in ())) 00136 nil_forward_ref = true; 00137 else 00138 { 00139 stubobj = 00140 effective_target->_stubobj (); 00141 00142 if (stubobj && stubobj->base_profiles ().size () == 0) 00143 nil_forward_ref = true; 00144 } 00145 00146 if (nil_forward_ref) 00147 throw ::CORBA::TRANSIENT ( 00148 CORBA::SystemException::_tao_minor_code ( 00149 TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, 00150 errno), 00151 CORBA::COMPLETED_NO); 00152 00153 if (stubobj == 0) 00154 throw ::CORBA::INTERNAL ( 00155 CORBA::SystemException::_tao_minor_code ( 00156 TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, 00157 errno), 00158 CORBA::COMPLETED_NO); 00159 00160 // Reset the profile in the stubs 00161 stub->add_forward_profiles (stubobj->base_profiles (), permanent_forward); 00162 00163 if (stub->next_profile () == 0) 00164 throw ::CORBA::TRANSIENT ( 00165 CORBA::SystemException::_tao_minor_code ( 00166 TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE, 00167 errno), 00168 CORBA::COMPLETED_NO); 00169 00170 return; 00171 }
CORBA::PolicyList_var TAO::LocateRequest_Invocation_Adapter::list_ [private] |
Definition at line 81 of file LocateRequest_Invocation_Adapter.h.
Referenced by get_inconsistent_policies(), and invoke().
CORBA::Object_ptr TAO::LocateRequest_Invocation_Adapter::target_ [private] |
Definition at line 80 of file LocateRequest_Invocation_Adapter.h.
Referenced by get_timeout(), and invoke().