#include <Remote_Invocation.h>
Inheritance diagram for TAO::Remote_Invocation:
Public Member Functions | |
Remote_Invocation (CORBA::Object_ptr otarget, Profile_Transport_Resolver &resolver, TAO_Operation_Details &detail, bool response_expected) | |
Protected Member Functions | |
void | init_target_spec (TAO_Target_Specification &spec) |
Initialize the spec. | |
void | write_header (TAO_Target_Specification &spec, TAO_OutputCDR &out_stream) |
Write the GIOP header into the stream. | |
void | marshal_data (TAO_OutputCDR &cdr) |
Marshal the arguments into the stream. | |
Invocation_Status | send_message (TAO_OutputCDR &cdr, short message_semantics, ACE_Time_Value *max_wait_time) |
Write the message onto the socket. | |
Protected Attributes | |
Profile_Transport_Resolver & | resolver_ |
Our resolver. |
This class encapulates some of the common functionalities used by synchronous, asynchronous, DII and DSI invocations.
Definition at line 51 of file Remote_Invocation.h.
|
Definition at line 22 of file Remote_Invocation.cpp. References CORBA::Object_ptr.
00027 : Invocation_Base (otarget, 00028 resolver.object (), 00029 resolver.stub (), 00030 detail, 00031 response_expected, 00032 true /* request_is_remote */ ) 00033 , resolver_ (resolver) 00034 { 00035 } |
|
Initialize the spec.
Mega hack for RTCORBA start. I don't think that PortableInterceptor would work here esp. for RTCORBA. PI needs to be improved to help our cause. Mega hack for RTCORBA END Definition at line 38 of file Remote_Invocation.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ERROR, ACE_TEXT, TAO_Profile::addressing_mode(), TAO_Stub::create_ior_info(), TAO_Profile::create_tagged_profile(), LM_ERROR, TAO_Profile::object_key(), TAO_Stub::orb_core(), TAO::Profile_Transport_Resolver::profile(), TAO_Operation_Details::request_service_context(), resolver_, TAO_ORB_Core::service_context_list(), TAO::Profile_Transport_Resolver::stub(), and TAO_debug_level.
00040 { 00041 /** 00042 * Mega hack for RTCORBA start. I don't think that 00043 * PortableInterceptor would work here esp. for RTCORBA. PI needs 00044 * to be improved to help our cause. 00045 */ 00046 this->resolver_.stub ()->orb_core ()->service_context_list ( 00047 this->resolver_.stub (), 00048 this->details_.request_service_context (), 00049 0 00050 ACE_ENV_ARG_PARAMETER); 00051 ACE_CHECK; 00052 /** 00053 * Mega hack for RTCORBA END 00054 */ 00055 00056 TAO_Profile *pfile = this->resolver_.profile (); 00057 00058 // Set the target specification mode 00059 switch (pfile->addressing_mode ()) 00060 { 00061 case TAO_Target_Specification::Key_Addr: 00062 target_spec.target_specifier (pfile->object_key ()); 00063 break; 00064 case TAO_Target_Specification::Profile_Addr: 00065 { 00066 IOP::TaggedProfile *tp = 00067 pfile->create_tagged_profile (); 00068 00069 if (tp) 00070 { 00071 target_spec.target_specifier (*tp); 00072 } 00073 } 00074 break; 00075 00076 case TAO_Target_Specification::Reference_Addr: 00077 // We need to call the method seperately. If there is no 00078 // IOP::IOR info, the call would create the info and return the 00079 // index that we need. 00080 CORBA::ULong index = 0; 00081 IOP::IOR *ior_info = 0; 00082 int const retval = 00083 this->resolver_.stub ()->create_ior_info (ior_info, 00084 index 00085 ACE_ENV_ARG_PARAMETER); 00086 ACE_CHECK; 00087 00088 if (retval == -1) 00089 { 00090 if (TAO_debug_level > 0) 00091 { 00092 ACE_ERROR ((LM_ERROR, 00093 ACE_TEXT ("TAO (%P|%t) - ") 00094 ACE_TEXT ("Remote_Invocation::init_target_spec, ") 00095 ACE_TEXT ("Error in finding index for ") 00096 ACE_TEXT ("IOP::IOR \n"))); 00097 } 00098 00099 return; 00100 } 00101 00102 target_spec.target_specifier (*ior_info, 00103 index); 00104 break; 00105 } 00106 00107 00108 } |
|
Marshal the arguments into the stream.
Definition at line 132 of file Remote_Invocation.cpp. References ACE_THROW, and TAO_Operation_Details::marshal_args().
00134 { 00135 if (this->details_.marshal_args (out_stream) == false) 00136 { 00137 ACE_THROW (CORBA::MARSHAL ()); 00138 } 00139 00140 return; 00141 } |
|
Write the message onto the socket.
Definition at line 144 of file Remote_Invocation.cpp. References ACE_CHECK_RETURN, ACE_DEBUG, ACE_ENV_ARG_PARAMETER, ACE_TEXT, ACE_THROW_RETURN, TAO_Transport::close_connection(), TAO_Transport::connection_handler(), ETIME, TAO_ORB_Core::get_protocols_hooks(), LM_DEBUG, TAO_Stub::orb_core(), TAO_Stub::reset_profiles(), resolver_, TAO_Transport::send_request(), TAO_Protocols_Hooks::set_client_network_priority(), TAO_Connection_Handler::set_dscp_codepoint(), TAO_Stub::set_valid_profile(), TAO::Profile_Transport_Resolver::stub(), TAO_debug_level, TAO::TAO_INVOKE_FAILURE, TAO::TAO_INVOKE_RESTART, TAO::TAO_INVOKE_SUCCESS, TAO_TIMEOUT_SEND_MINOR_CODE, and TAO::Profile_Transport_Resolver::transport().
00148 { 00149 TAO_Protocols_Hooks *tph = 00150 this->resolver_.stub ()->orb_core ()->get_protocols_hooks (); 00151 00152 CORBA::Boolean set_client_network_priority = 00153 tph->set_client_network_priority (this->resolver_.transport ()->tag (), 00154 this->resolver_.stub () 00155 ACE_ENV_ARG_PARAMETER); 00156 ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); 00157 00158 TAO_Connection_Handler *connection_handler = 00159 this->resolver_.transport ()->connection_handler (); 00160 00161 connection_handler->set_dscp_codepoint (set_client_network_priority); 00162 00163 int const retval = 00164 this->resolver_.transport ()->send_request ( 00165 this->resolver_.stub (), 00166 this->resolver_.stub ()->orb_core (), 00167 cdr, 00168 message_semantics, 00169 max_wait_time); 00170 00171 if (retval == -1) 00172 { 00173 if (errno == ETIME) 00174 { 00175 // We sent a message already and we haven't gotten a 00176 // reply. Just throw TIMEOUT with *COMPLETED_MAYBE*. 00177 ACE_THROW_RETURN ( 00178 CORBA::TIMEOUT ( 00179 CORBA::SystemException::_tao_minor_code ( 00180 TAO_TIMEOUT_SEND_MINOR_CODE, 00181 errno 00182 ), 00183 CORBA::COMPLETED_MAYBE 00184 ), 00185 TAO_INVOKE_FAILURE 00186 ); 00187 } 00188 00189 if (TAO_debug_level > 2) 00190 { 00191 ACE_DEBUG ((LM_DEBUG, 00192 ACE_TEXT ("TAO (%P|%t) - ") 00193 ACE_TEXT ("Remote_Invocation::send_message, ") 00194 ACE_TEXT ("failure while sending message \n"))); 00195 } 00196 00197 // Close the transport and all the associated stuff along with 00198 // it. 00199 this->resolver_.transport ()->close_connection (); 00200 this->resolver_.stub ()->reset_profiles (); 00201 return TAO_INVOKE_RESTART; 00202 } 00203 00204 this->resolver_.stub ()->set_valid_profile (); 00205 return TAO_INVOKE_SUCCESS; 00206 } |
|
Write the GIOP header into the stream.
Definition at line 111 of file Remote_Invocation.cpp. References ACE_THROW, TAO_Transport::assign_translators(), TAO_Transport::clear_translators(), TAO_Transport::generate_request_header(), resolver_, and TAO::Profile_Transport_Resolver::transport().
00114 { 00115 this->resolver_.transport ()->clear_translators (0, 00116 &out_stream); 00117 00118 // Send the request for the header 00119 if (this->resolver_.transport ()->generate_request_header (this->details_, 00120 spec, 00121 out_stream) 00122 == -1) 00123 { 00124 ACE_THROW (CORBA::MARSHAL ()); 00125 } 00126 00127 this->resolver_.transport ()->assign_translators (0, 00128 &out_stream); 00129 } |
|
Our resolver.
Definition at line 94 of file Remote_Invocation.h. Referenced by init_target_spec(), send_message(), and write_header(). |