TAO::Remote_Invocation Class Reference

Base class for remote invocations. More...

#include <Remote_Invocation.h>

Inheritance diagram for TAO::Remote_Invocation:

Inheritance graph
[legend]
Collaboration diagram for TAO::Remote_Invocation:

Collaboration graph
[legend]
List of all members.

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_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, TAO_Transport::TAO_Message_Semantics message_semantics, ACE_Time_Value *max_wait_time)
 Write the message onto the socket.

Protected Attributes

Profile_Transport_Resolverresolver_
 Our resolver.

Detailed Description

Base class for remote invocations.

This class encapulates some of the common functionalities used by synchronous, asynchronous, DII and DSI invocations.

Definition at line 46 of file Remote_Invocation.h.


Constructor & Destructor Documentation

TAO::Remote_Invocation::Remote_Invocation ( CORBA::Object_ptr  otarget,
Profile_Transport_Resolver resolver,
TAO_Operation_Details detail,
bool  response_expected 
)

Parameters:
otarget The original target on which this invocation was started. This is there to be passed up to its parent class.
resolver The profile and transport holder.
detail Pperation details of the invocation on the target
response_expected Flag to indicate whether the operation encapsulated by op returns a response or not.

Definition at line 23 of file Remote_Invocation.cpp.

00028     : Invocation_Base (otarget,
00029                        resolver.object (),
00030                        resolver.stub (),
00031                        detail,
00032                        response_expected,
00033                        true /* request_is_remote */ )
00034     , resolver_ (resolver)
00035   {
00036   }


Member Function Documentation

void TAO::Remote_Invocation::init_target_spec ( TAO_Target_Specification spec  )  [protected]

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 39 of file Remote_Invocation.cpp.

References ACE_ERROR, ACE_TEXT, TAO_Profile::addressing_mode(), TAO_Profile::create_tagged_profile(), TAO_Target_Specification::Key_Addr, LM_ERROR, TAO_Profile::object_key(), TAO_Stub::orb_core(), TAO::Profile_Transport_Resolver::profile(), TAO_Target_Specification::Profile_Addr, TAO_Target_Specification::Reference_Addr, 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 write_header().

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     /**
00051      * Mega hack for RTCORBA END
00052      */
00053 
00054     TAO_Profile *pfile = this->resolver_.profile ();
00055 
00056     // Set the target specification mode
00057     switch (pfile->addressing_mode ())
00058       {
00059       case TAO_Target_Specification::Key_Addr:
00060         target_spec.target_specifier (pfile->object_key ());
00061         break;
00062       case TAO_Target_Specification::Profile_Addr:
00063         {
00064           IOP::TaggedProfile *tp =
00065             pfile->create_tagged_profile ();
00066 
00067           if (tp)
00068             {
00069               target_spec.target_specifier (*tp);
00070             }
00071         }
00072         break;
00073 
00074     case TAO_Target_Specification::Reference_Addr:
00075       // We need to call the method seperately. If there is no
00076       // IOP::IOR info, the call would create the info and return the
00077       // index that we need.
00078       CORBA::ULong index = 0;
00079       IOP::IOR *ior_info = 0;
00080 
00081       if (this->resolver_.stub ()->create_ior_info (ior_info, index) == -1)
00082         {
00083           if (TAO_debug_level > 0)
00084             {
00085               ACE_ERROR ((LM_ERROR,
00086                           ACE_TEXT ("TAO (%P|%t) - ")
00087                           ACE_TEXT ("Remote_Invocation::init_target_spec, ")
00088                           ACE_TEXT ("Error in finding index for ")
00089                           ACE_TEXT ("IOP::IOR \n")));
00090             }
00091 
00092           return;
00093         }
00094 
00095       target_spec.target_specifier (*ior_info, index);
00096       break;
00097     }
00098   }

void TAO::Remote_Invocation::marshal_data ( TAO_OutputCDR cdr  )  [protected]

Marshal the arguments into the stream.

Definition at line 120 of file Remote_Invocation.cpp.

00121   {
00122     if (this->details_.marshal_args (out_stream) == false)
00123       {
00124         throw ::CORBA::MARSHAL ();
00125       }
00126   }

Invocation_Status TAO::Remote_Invocation::send_message ( TAO_OutputCDR cdr,
TAO_Transport::TAO_Message_Semantics  message_semantics,
ACE_Time_Value max_wait_time 
) [protected]

Write the message onto the socket.

Definition at line 129 of file Remote_Invocation.cpp.

References CORBA::SystemException::_tao_minor_code(), ACE_DEBUG, ACE_TEXT, TAO_Transport::close_connection(), CORBA::COMPLETED_MAYBE, TAO_Transport::connection_handler(), 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().

00132   {
00133     TAO_Protocols_Hooks *tph =
00134       this->resolver_.stub ()->orb_core ()->get_protocols_hooks ();
00135 
00136     TAO_Network_Priority_Protocols_Hooks *nph =
00137       this->resolver_.stub ()->orb_core ()->
00138         get_network_priority_protocols_hooks ();
00139 
00140     TAO_Connection_Handler *connection_handler =
00141       this->resolver_.transport ()->connection_handler ();
00142 
00143     if (nph != 0)
00144       {
00145         // nph = 0, means DiffServ library is not used
00146         // nph = 0, means DiffServ library is used, and
00147         // request DSCP and reply DSCP are set.
00148         // Note that the application could still be using
00149         // RTCORBA, but still setting DIffServ codepoints
00150         // using the DiffServ library takes precedence.
00151         //
00152         CORBA::Long const dscp = nph->get_dscp_codepoint (this->resolver_.stub (),
00153           this->resolver_.object ());
00154         connection_handler->set_dscp_codepoint (dscp);
00155       }
00156     else if (tph != 0)
00157       {
00158         // If we execute this code, DiffServ library is not used,
00159         // but RTCORBA could be used.
00160         // Which means that using the enable_network_priority flag,
00161         // the application might want to set DiffServ codepoints.
00162         // Check if that is the case.
00163         //
00164         CORBA::Boolean const set_client_network_priority =
00165           tph->set_client_network_priority (
00166             this->resolver_.transport ()->tag (),
00167             this->resolver_.stub ());
00168         connection_handler->set_dscp_codepoint (set_client_network_priority);
00169       }
00170 
00171     // Note that if noth nph and tph are 0, then we do not make any
00172     // virtual calls any more, because we have removed the default
00173     // implementations.
00174 
00175     int const retval =
00176       this->resolver_.transport ()->send_request (
00177         this->resolver_.stub (),
00178         this->resolver_.stub ()->orb_core (),
00179         cdr,
00180         message_semantics,
00181         max_wait_time);
00182 
00183     if (retval == -1)
00184       {
00185         if (errno == ETIME)
00186           {
00187             // We sent a message already and we haven't gotten a
00188             // reply.  Just throw TIMEOUT with *COMPLETED_MAYBE*.
00189             throw ::CORBA::TIMEOUT (
00190               CORBA::SystemException::_tao_minor_code (
00191                 TAO_TIMEOUT_SEND_MINOR_CODE,
00192                 errno),
00193               CORBA::COMPLETED_MAYBE);
00194           }
00195 
00196         if (TAO_debug_level > 2)
00197           {
00198             ACE_DEBUG ((LM_DEBUG,
00199                         ACE_TEXT ("TAO (%P|%t) - ")
00200                         ACE_TEXT ("Remote_Invocation::send_message, ")
00201                         ACE_TEXT ("failure while sending message \n")));
00202           }
00203 
00204         // Close the transport and all the associated stuff along with
00205         // it.
00206         this->resolver_.transport ()->close_connection ();
00207         this->resolver_.stub ()->reset_profiles ();
00208         return TAO_INVOKE_RESTART;
00209       }
00210 
00211     this->resolver_.stub ()->set_valid_profile ();
00212     return TAO_INVOKE_SUCCESS;
00213   }

void TAO::Remote_Invocation::write_header ( TAO_OutputCDR out_stream  )  [protected]

Write the GIOP header into the stream.

Definition at line 101 of file Remote_Invocation.cpp.

References TAO_Transport::assign_translators(), TAO_Transport::clear_translators(), init_target_spec(), resolver_, and TAO::Profile_Transport_Resolver::transport().

00102   {
00103     TAO_Target_Specification spec;
00104     this->init_target_spec (spec);
00105 
00106     this->resolver_.transport ()->clear_translators (0, &out_stream);
00107 
00108     // Send the request for the header
00109     if (this->resolver_.transport ()->generate_request_header (this->details_,
00110                                                                spec,
00111                                                                out_stream) == -1)
00112       {
00113         throw ::CORBA::MARSHAL ();
00114       }
00115 
00116     this->resolver_.transport ()->assign_translators (0, &out_stream);
00117   }


Member Data Documentation

Profile_Transport_Resolver& TAO::Remote_Invocation::resolver_ [protected]

Our resolver.

Definition at line 84 of file Remote_Invocation.h.

Referenced by init_target_spec(), send_message(), and write_header().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:39:18 2010 for TAO by  doxygen 1.4.7