#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 45 of file Remote_Invocation.h.
|
Definition at line 24 of file Remote_Invocation.cpp. References CORBA::Object_ptr.
00029 : Invocation_Base (otarget, 00030 resolver.object (), 00031 resolver.stub (), 00032 detail, 00033 response_expected, 00034 true /* request_is_remote */ ) 00035 , resolver_ (resolver) 00036 { 00037 } |
|
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 40 of file Remote_Invocation.cpp. References 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(), TAO_debug_level, and TAO_Target_Specification::target_specifier(). Referenced by TAO::LocateRequest_Invocation::invoke(), TAO::Synch_Oneway_Invocation::remote_oneway(), and TAO::Synch_Twoway_Invocation::remote_twoway().
00041 { 00042 /** 00043 * Mega hack for RTCORBA start. I don't think that 00044 * PortableInterceptor would work here esp. for RTCORBA. PI needs 00045 * to be improved to help our cause. 00046 */ 00047 this->resolver_.stub ()->orb_core ()->service_context_list ( 00048 this->resolver_.stub (), 00049 this->details_.request_service_context (), 00050 0); 00051 /** 00052 * Mega hack for RTCORBA END 00053 */ 00054 00055 TAO_Profile *pfile = this->resolver_.profile (); 00056 00057 // Set the target specification mode 00058 switch (pfile->addressing_mode ()) 00059 { 00060 case TAO_Target_Specification::Key_Addr: 00061 target_spec.target_specifier (pfile->object_key ()); 00062 break; 00063 case TAO_Target_Specification::Profile_Addr: 00064 { 00065 IOP::TaggedProfile *tp = 00066 pfile->create_tagged_profile (); 00067 00068 if (tp) 00069 { 00070 target_spec.target_specifier (*tp); 00071 } 00072 } 00073 break; 00074 00075 case TAO_Target_Specification::Reference_Addr: 00076 // We need to call the method seperately. If there is no 00077 // IOP::IOR info, the call would create the info and return the 00078 // index that we need. 00079 CORBA::ULong index = 0; 00080 IOP::IOR *ior_info = 0; 00081 int const retval = 00082 this->resolver_.stub ()->create_ior_info (ior_info, index); 00083 00084 if (retval == -1) 00085 { 00086 if (TAO_debug_level > 0) 00087 { 00088 ACE_ERROR ((LM_ERROR, 00089 ACE_TEXT ("TAO (%P|%t) - ") 00090 ACE_TEXT ("Remote_Invocation::init_target_spec, ") 00091 ACE_TEXT ("Error in finding index for ") 00092 ACE_TEXT ("IOP::IOR \n"))); 00093 } 00094 00095 return; 00096 } 00097 00098 target_spec.target_specifier (*ior_info, index); 00099 break; 00100 } 00101 } |
|
Marshal the arguments into the stream.
Definition at line 122 of file Remote_Invocation.cpp. References TAO_Operation_Details::marshal_args(). Referenced by TAO::Synch_Oneway_Invocation::remote_oneway(), and TAO::Synch_Twoway_Invocation::remote_twoway().
00123 { 00124 if (this->details_.marshal_args (out_stream) == false) 00125 { 00126 throw ::CORBA::MARSHAL (); 00127 } 00128 } |
|
Write the message onto the socket.
Definition at line 131 of file Remote_Invocation.cpp. References ACE_DEBUG, ACE_TEXT, TAO_Transport::close_connection(), TAO_Transport::connection_handler(), ETIME, TAO_Network_Priority_Protocols_Hooks::get_dscp_codepoint(), TAO_ORB_Core::get_protocols_hooks(), LM_DEBUG, TAO::Profile_Transport_Resolver::object(), 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_RESTART, TAO::TAO_INVOKE_SUCCESS, TAO_TIMEOUT_SEND_MINOR_CODE, and TAO::Profile_Transport_Resolver::transport(). Referenced by TAO::LocateRequest_Invocation::invoke(), TAO::Synch_Oneway_Invocation::remote_oneway(), and TAO::Synch_Twoway_Invocation::remote_twoway().
00134 { 00135 TAO_Protocols_Hooks *tph = 00136 this->resolver_.stub ()->orb_core ()->get_protocols_hooks (); 00137 00138 TAO_Network_Priority_Protocols_Hooks *nph = 00139 this->resolver_.stub ()->orb_core ()-> 00140 get_network_priority_protocols_hooks (); 00141 00142 TAO_Connection_Handler *connection_handler = 00143 this->resolver_.transport ()->connection_handler (); 00144 00145 if (nph != 0) 00146 { 00147 // nph = 0, means DiffServ library is not used 00148 // nph = 0, means DiffServ library is used, and 00149 // request DSCP and reply DSCP are set. 00150 // Note that the application could still be using 00151 // RTCORBA, but still setting DIffServ codepoints 00152 // using the DiffServ library takes precedence. 00153 // 00154 CORBA::Long dscp = nph->get_dscp_codepoint (this->resolver_.stub (), 00155 this->resolver_.object ()); 00156 connection_handler->set_dscp_codepoint (dscp); 00157 } 00158 else if (tph != 0) 00159 { 00160 // If we execute this code, DiffServ library is not used, 00161 // but RTCORBA could be used. 00162 // Which means that using the enable_network_priority flag, 00163 // the application might want to set DiffServ codepoints. 00164 // Check if that is the case. 00165 // 00166 CORBA::Boolean const set_client_network_priority = 00167 tph->set_client_network_priority ( 00168 this->resolver_.transport ()->tag (), 00169 this->resolver_.stub ()); 00170 connection_handler->set_dscp_codepoint (set_client_network_priority); 00171 } 00172 00173 // Note that if noth nph and tph are 0, then we do not make any 00174 // virtual calls any more, because we have removed the default 00175 // implementations. 00176 00177 int const retval = 00178 this->resolver_.transport ()->send_request ( 00179 this->resolver_.stub (), 00180 this->resolver_.stub ()->orb_core (), 00181 cdr, 00182 message_semantics, 00183 max_wait_time); 00184 00185 if (retval == -1) 00186 { 00187 if (errno == ETIME) 00188 { 00189 // We sent a message already and we haven't gotten a 00190 // reply. Just throw TIMEOUT with *COMPLETED_MAYBE*. 00191 throw ::CORBA::TIMEOUT ( 00192 CORBA::SystemException::_tao_minor_code ( 00193 TAO_TIMEOUT_SEND_MINOR_CODE, 00194 errno), 00195 CORBA::COMPLETED_MAYBE); 00196 } 00197 00198 if (TAO_debug_level > 2) 00199 { 00200 ACE_DEBUG ((LM_DEBUG, 00201 ACE_TEXT ("TAO (%P|%t) - ") 00202 ACE_TEXT ("Remote_Invocation::send_message, ") 00203 ACE_TEXT ("failure while sending message \n"))); 00204 } 00205 00206 // Close the transport and all the associated stuff along with 00207 // it. 00208 this->resolver_.transport ()->close_connection (); 00209 this->resolver_.stub ()->reset_profiles (); 00210 return TAO_INVOKE_RESTART; 00211 } 00212 00213 this->resolver_.stub ()->set_valid_profile (); 00214 return TAO_INVOKE_SUCCESS; 00215 } |
|
Write the GIOP header into the stream.
Definition at line 104 of file Remote_Invocation.cpp. References TAO_Transport::assign_translators(), TAO_Transport::clear_translators(), TAO_Transport::generate_request_header(), resolver_, and TAO::Profile_Transport_Resolver::transport(). Referenced by TAO::Synch_Oneway_Invocation::remote_oneway(), and TAO::Synch_Twoway_Invocation::remote_twoway().
00106 { 00107 this->resolver_.transport ()->clear_translators (0, &out_stream); 00108 00109 // Send the request for the header 00110 if (this->resolver_.transport ()->generate_request_header (this->details_, 00111 spec, 00112 out_stream) 00113 == -1) 00114 { 00115 throw ::CORBA::MARSHAL (); 00116 } 00117 00118 this->resolver_.transport ()->assign_translators (0, &out_stream); 00119 } |
|
Our resolver.
Definition at line 84 of file Remote_Invocation.h. Referenced by init_target_spec(), send_message(), and write_header(). |