Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_GIOP_Invocation Class Reference

Encapsulates common behavior for both oneway and twoway invocations. More...

#include <Invocation.h>

Inheritance diagram for TAO_GIOP_Invocation:

Inheritance graph
[legend]
Collaboration diagram for TAO_GIOP_Invocation:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_GIOP_Invocation (void)
 Default constructor. This should never get called, it is here only to appease older versions of g++. More...

 TAO_GIOP_Invocation (TAO_Stub *data, const char *operation, CORBA::ULong opname_len, CORBA::Boolean argument_flag, TAO_ORB_Core *orb_core, int byte_order=TAO_ENCAP_BYTE_ORDER)
 Constructor. More...

virtual ~TAO_GIOP_Invocation (void)
void prepare_header (CORBA::Octet response_flags ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
TAO_Service_Contextrequest_service_context (void)
 Accessor to the request ServiceContextList. Only valid when sending a request message. More...

TAO_Service_Contextreply_service_context (void)
 Accessor to the reply ServiceContextList. Only valid when after receiving a reply message. More...

CORBA::ULong request_id (void) const
 Return the request id of this invocation. More...

const char * operation (void)
 Return the name of the operation being invoked. More...

TAO_OutputCDRout_stream (void)
 Return the underlying output stream. More...

void restart_flag (CORBA::Boolean flag)
 Set the value for the restart flag. More...

int close_connection (void)
 Resets the forwarding profile and behaves like we are fowarded (to the same server). More...

void start (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Establishes a connection to the remote server, initializes the GIOP headers in the output CDR. More...

int perform_call (TAO_Transport_Descriptor_Interface &desc ACE_ENV_ARG_DECL)
 Called by the invocation endpoint selector for each selected endpoint. More...

void init_inconsistent_policies (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException)
 Dynamically allocate inconsistent_policies_ PolicyList. More...

CORBA::PolicyListget_inconsistent_policies (void)
 Return PolicyList stored in inconsistent_policies_ and give up its ownership. User must deallocate memory. More...

int location_forward (CORBA::Object_ptr forward ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
CORBA::Object_ptr forward_reference (void)
 Return the object reference returned in the LOCATION_FORWARD reply. The return reference is only valid if the reply status for the current reply is TAO_INVOKE_RESTART. More...

CORBA::Boolean received_location_forward (void) const
 Returns true if a location forward was. More...

TAO_Stubstub (void)
 Accessor for the stub associated with this invocation. More...

TAO_Transport *& transport (void)
 Return the TAO_Transport in use for the current Invocation object. More...

CORBA::PolicyList_varinconsistent_policies ()
 Accessor for the stub associated with this invocation. More...

TAO_Endpointendpoint (void)
 Endpoint Accessor. More...

void endpoint (TAO_Endpoint *ep)
TAO_Profileprofile (void)
 Profile Accessor. More...

void profile (TAO_Profile *p)
 Profile Accessor. More...

TAO_ORB_Coreorb_core (void)
 ORB_Core Accessor. More...

ACE_Time_Valuemax_wait_time (void)
 Return the current timeout value for the current invocation. More...

CORBA::ULongprofile_index (void)

Protected Methods

int invoke (CORBA::Boolean write_semantics ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 Sends the request, does not wait for the response. More...

int location_forward (TAO_InputCDR &inp_stream ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
void location_forward_i (TAO_Stub *stubobj ACE_ENV_ARG_DECL) throw (CORBA::SystemException)

Protected Attributes

TAO_Stubstub_
 The object on which this invocation is going. More...

char buffer_ [ACE_CDR::DEFAULT_BUFSIZE]
 Buffer used for both the output and input CDR streams, this is "safe" because we only one of the streams at a time. More...

TAO_Operation_Details op_details_
 The relevant operation detail. More...

TAO_Target_Specification target_spec_
TAO_OutputCDR out_stream_
 Stream into which the response is placed. More...

TAO_ORB_Coreorb_core_
 The orb_core context where we make this invocation. More...

TAO_Transporttransport_
 This invocation is using this transport.
Note:
may change...
More...


TAO_Invocation_Endpoint_Selectorendpoint_selector_
 Strategy for making decisions about which endpoint/profile to use for invocation. More...

CORBA::PolicyList_var inconsistent_policies_
TAO_Profileprofile_
 This invocation is using this profile. More...

TAO_Endpointendpoint_
 This invocation is using this endpoint from
Parameters:
profile_. 
More...


ACE_Countdown_Timecountdown_
 Keep track of the remaining time for this invocation. More...

CORBA::Boolean restart_flag_
CORBA::Object_var forward_reference_
CORBA::Boolean received_location_forward_
 Flag is true when a LOCATION_FORWARD reply is received. More...

CORBA::ULong profile_index_
 Keep the position of the profile that should be used in performing the invocation. More...

ACE_Time_Value max_wait_time_value_
ACE_Time_Valuemax_wait_time_

Detailed Description

Encapsulates common behavior for both oneway and twoway invocations.

This class connects (or lookups a connection from the cache) to the remote server, builds the CDR stream for the Request, send the CDR stream and expects the response and interprets the incoming CDR stream.

Definition at line 73 of file Invocation.h.


Constructor & Destructor Documentation

TAO_GIOP_Invocation::TAO_GIOP_Invocation void   
 

Default constructor. This should never get called, it is here only to appease older versions of g++.

Definition at line 85 of file Invocation.cpp.

References buffer_, and ACE_OS_String::memset.

00086   : stub_ (0),
00087     op_details_ (0,
00088                  0,
00089                  0),
00090     out_stream_ (),
00091     orb_core_ (0),
00092     transport_ (0),
00093     endpoint_selector_ (0),
00094     inconsistent_policies_ (0),
00095     profile_ (0),
00096     endpoint_ (0),
00097     max_wait_time_ (0),
00098     restart_flag_ (0),
00099     forward_reference_ (),
00100     received_location_forward_ (0),
00101     profile_index_ (0)
00102 {
00103 #if defined (ACE_HAS_PURIFY)
00104   ACE_OS::memset(buffer_, 0, sizeof(buffer_));
00105 #endif /* ACE_HAS_PURIFY */
00106 }

TAO_GIOP_Invocation::TAO_GIOP_Invocation TAO_Stub   data,
const char *    operation,
CORBA::ULong    opname_len,
CORBA::Boolean    argument_flag,
TAO_ORB_Core   orb_core,
int    byte_order = TAO_ENCAP_BYTE_ORDER
 

Constructor.

Definition at line 108 of file Invocation.cpp.

References buffer_, ACE_OS_String::memset, TAO_DEF_GIOP_MAJOR, and TAO_DEF_GIOP_MINOR.

00114   : stub_ (stub),
00115     op_details_ (operation,
00116                  opname_len,
00117                  argument_flag),
00118     out_stream_ (this->buffer_,
00119                  sizeof this->buffer_, /* ACE_CDR::DEFAULT_BUFSIZE */
00120                  byte_order,
00121                  orb_core->output_cdr_buffer_allocator (),
00122                  orb_core->output_cdr_dblock_allocator (),
00123                  orb_core->output_cdr_msgblock_allocator (),
00124                  orb_core->orb_params ()->cdr_memcpy_tradeoff (),
00125                  TAO_DEF_GIOP_MAJOR,
00126                  TAO_DEF_GIOP_MINOR),
00127     orb_core_ (orb_core),
00128     transport_ (0),
00129     endpoint_selector_ (0),
00130     inconsistent_policies_ (0),
00131     profile_ (0),
00132     endpoint_ (0),
00133     max_wait_time_ (0),
00134     restart_flag_ (0),
00135     forward_reference_ (),
00136     received_location_forward_ (0),
00137     profile_index_ (0)
00138 {
00139 #if defined (ACE_HAS_PURIFY)
00140   ACE_OS::memset(buffer_, 0, sizeof(buffer_));
00141 #endif /* ACE_HAS_PURIFY */
00142 }

TAO_GIOP_Invocation::~TAO_GIOP_Invocation void    [virtual]
 

This destructor is virtual so that the derived synchronous invocation classes can call <idle> method on the <Transport>, if they want to. All the synchronous invocations <idle> the Transport, but asynchronous invocations do not do that.

Definition at line 144 of file Invocation.cpp.

References TAO_Transport::release.

00145 {
00146   TAO_Transport::release (this->transport_);
00147 }


Member Function Documentation

int TAO_GIOP_Invocation::close_connection void   
 

Resets the forwarding profile and behaves like we are fowarded (to the same server).

Definition at line 476 of file Invocation.cpp.

References TAO_Invocation_Endpoint_Selector::close_connection, TAO_Transport::close_connection, endpoint_, endpoint_selector_, profile_, TAO_Transport::release, TAO_Endpoint::reset_hint, TAO_INVOKE_RESTART, and transport_.

Referenced by TAO_ORB_Core::service_raise_comm_failure.

00477 {
00478   // Special case of forwarding -- server was closing the
00479   // connection, which just indicates resource constraints, not an
00480   // error.  The client is effectively "forwarded" to the same
00481   // server!
00482   //
00483   // However, we must reinitialize the forwarding chain, since the
00484   // resource being reclaimed might also have been the process,
00485   // not just the connection.  Without reinitializing, we'd give
00486   // false error reports to applications.
00487 
00488   this->transport_->close_connection ();
00489   // this->transport_->idle ();
00490   TAO_Transport::release (this->transport_);
00491   this->transport_ = 0;
00492 
00493   this->endpoint_->reset_hint ();
00494   this->endpoint_ = 0;
00495   this->profile_ = 0;
00496 
00497   this->endpoint_selector_->close_connection (this);
00498 
00499   return TAO_INVOKE_RESTART;
00500 }

ACE_INLINE void TAO_GIOP_Invocation::endpoint TAO_Endpoint   ep
 

Definition at line 87 of file Invocation.i.

References endpoint_.

00088 {
00089   this->endpoint_ = ep;
00090 }

ACE_INLINE TAO_Endpoint * TAO_GIOP_Invocation::endpoint void   
 

Endpoint Accessor.

Definition at line 81 of file Invocation.i.

References endpoint_.

Referenced by TAO_GIOP_Twoway_Invocation::reset_states.

00082 {
00083   return this->endpoint_;
00084 }

ACE_INLINE CORBA::Object_ptr TAO_GIOP_Invocation::forward_reference void   
 

Return the object reference returned in the LOCATION_FORWARD reply. The return reference is only valid if the reply status for the current reply is TAO_INVOKE_RESTART.

Definition at line 43 of file Invocation.i.

00044 {
00045   return CORBA::Object::_duplicate (this->forward_reference_.in ());
00046 }

ACE_INLINE CORBA::PolicyList * TAO_GIOP_Invocation::get_inconsistent_policies void   
 

Return PolicyList stored in inconsistent_policies_ and give up its ownership. User must deallocate memory.

Definition at line 69 of file Invocation.i.

References CORBA::PolicyList_var::_retn, and inconsistent_policies_.

Referenced by TAO_Stub::validate_connection.

00070 {
00071   return this->inconsistent_policies_._retn ();
00072 }

ACE_INLINE CORBA::PolicyList_var & TAO_GIOP_Invocation::inconsistent_policies  
 

Accessor for the stub associated with this invocation.

Definition at line 119 of file Invocation.i.

References inconsistent_policies_.

00120 {
00121   return this->inconsistent_policies_;
00122 }

ACE_INLINE void TAO_GIOP_Invocation::init_inconsistent_policies ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Dynamically allocate inconsistent_policies_ PolicyList.

Definition at line 55 of file Invocation.i.

References ACE_ENV_SINGLE_ARG_DECL, ACE_NEW_THROW_EX, and TAO_DEFAULT_MINOR_CODE.

Referenced by TAO_Stub::validate_connection.

00058 {
00059   ACE_NEW_THROW_EX (this->inconsistent_policies_,
00060                     CORBA::PolicyList (0),
00061                     CORBA::NO_MEMORY (
00062                       CORBA::SystemException::_tao_minor_code (
00063                         TAO_DEFAULT_MINOR_CODE,
00064                         ENOMEM),
00065                       CORBA::COMPLETED_NO));
00066 }

int TAO_GIOP_Invocation::invoke CORBA::Boolean write_semantics    ACE_ENV_ARG_DECL throw (CORBA::SystemException) [protected]
 

Sends the request, does not wait for the response.

Returns TAO_INVOKE_RESTART if the write call failed and the request must be re-attempted.

Parameters:
write_semantics  If set invoke() does not return until the message is completely delivered to the underlying transport mechanism, or an error is detected.
Notice that the same profile is tried again because it may be that the server closed the connection simply to release resources.

Definition at line 410 of file Invocation.cpp.

References CORBA_SystemException::_tao_minor_code, ACE_ENV_ARG_DECL, ACE_THROW_RETURN, ETIME, TAO_INVOKE_EXCEPTION, TAO_INVOKE_OK, TAO_INVOKE_RESTART, and TAO_TIMEOUT_SEND_MINOR_CODE.

Referenced by TAO_GIOP_Oneway_Invocation::invoke, and TAO_GIOP_Synch_Invocation::invoke_i.

00413 {
00414   ACE_Countdown_Time countdown (this->max_wait_time_);
00415 
00416   if (this->transport_ == 0)
00417     {
00418       ACE_THROW_RETURN (CORBA::INTERNAL (),
00419                         TAO_INVOKE_EXCEPTION);
00420     }
00421 
00422   int result =
00423     this->transport_->send_request (this->stub_,
00424                                     this->orb_core_,
00425                                     this->out_stream_,
00426                                     write_semantics,
00427                                     this->max_wait_time_);
00428 
00429   //
00430   // @@ highly desirable to know whether we wrote _any_ data; if
00431   // we wrote none, then there's no chance the call completed and
00432   // applications don't have to deal with those nasty
00433   // indeterminate states where they can't immediatly tell if
00434   // what's safe to do.
00435   //
00436   // @@ also, there might have been a GIOP::CloseConnection
00437   // message in the input queue.  If so, this request should be
00438   // treated as a (full) "rebind" case.  Can't do that from this
00439   // point in the code however!  Some minor restructuring needs to
00440   // happen.
00441   //
00442 
00443   if (result == -1)
00444     {
00445       if (errno == ETIME)
00446         {
00447           ACE_THROW_RETURN (
00448               CORBA::TIMEOUT (
00449                   CORBA_SystemException::_tao_minor_code (
00450                       TAO_TIMEOUT_SEND_MINOR_CODE,
00451                       errno
00452                     ),
00453                   CORBA::COMPLETED_NO
00454                 ),
00455               TAO_INVOKE_EXCEPTION
00456             );
00457         }
00458       this->transport_->close_connection ();
00459 
00460       this->endpoint_->reset_hint ();
00461 
00462       this->restart_flag_ = 1;
00463 
00464       return TAO_INVOKE_RESTART;
00465     }
00466 
00467   // Indicate that the endpoint/profile was used successfully.
00468   // @@ Maybe the right place to do this is once the reply is
00469   //    received? But what about oneways?
00470   this->endpoint_selector_->success (this);
00471 
00472   return TAO_INVOKE_OK;
00473 }

int TAO_GIOP_Invocation::location_forward TAO_InputCDR &inp_stream    ACE_ENV_ARG_DECL throw (CORBA::SystemException) [protected]
 

Helper method, the response for a Request or LocateRequest was a LOCATION_FORWARD or TAO_GIOP_OBJECT_FORWARD. In any case we must demarshal the object reference and setup the profiles. The returned forward object reference can be retrieved by invoking the forward_reference() method in this class. It returns TAO_INVOKE_RESTART unless an exception is raised.

Definition at line 505 of file Invocation.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, TAO_INVOKE_EXCEPTION, and TAO_INVOKE_RESTART.

00508 {
00509   // It can be assumed that the GIOP header and the reply header
00510   // are already handled.  Further it can be assumed that the
00511   // reply body contains an object reference to the new object.
00512   // This object pointer will be now extracted.
00513 
00514   if ((inp_stream >> this->forward_reference_.out ()) == 0)
00515     {
00516       ACE_THROW_RETURN (CORBA::MARSHAL (),
00517                         TAO_INVOKE_EXCEPTION);
00518     }
00519 
00520   // The object pointer has to be changed to a TAO_Stub pointer
00521   // in order to obtain the profiles.
00522   TAO_Stub *stubobj = this->forward_reference_->_stubobj ();
00523 
00524   this->location_forward_i (stubobj
00525                             ACE_ENV_ARG_PARAMETER);
00526   ACE_CHECK_RETURN (TAO_INVOKE_EXCEPTION);
00527 
00528   return TAO_INVOKE_RESTART;
00529 }

int TAO_GIOP_Invocation::location_forward CORBA::Object_ptr forward    ACE_ENV_ARG_DECL throw (CORBA::SystemException)
 

Add the given object reference to the list of forward profiles. This basically emulates a LOCATION_FORWARD reply from the server. It is needed by such things as the PortableInterceptor::ForwardRequest exception.

The forward object reference can be retrieved by invoking the forward_reference() method in this class. It returns TAO_INVOKE_RESTART unless an exception is raised.

Definition at line 532 of file Invocation.cpp.

References ACE_CHECK_RETURN, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, CORBA::is_nil, TAO_INVOKE_EXCEPTION, and TAO_INVOKE_RESTART.

Referenced by TAO_ClientRequestInterceptor_Adapter::process_forward_request.

00535 {
00536   if (CORBA::is_nil (forward))
00537     ACE_THROW_RETURN (CORBA::INV_OBJREF (), TAO_INVOKE_EXCEPTION);
00538 
00539   this->forward_reference_ = CORBA::Object::_duplicate (forward);
00540 
00541   // The object pointer has to be changed to a TAO_Stub pointer
00542   // in order to obtain the profiles.
00543   TAO_Stub *stubobj = forward->_stubobj ();
00544 
00545   this->location_forward_i (stubobj
00546                             ACE_ENV_ARG_PARAMETER);
00547   ACE_CHECK_RETURN (TAO_INVOKE_EXCEPTION);
00548 
00549   return TAO_INVOKE_RESTART;
00550 }

void TAO_GIOP_Invocation::location_forward_i TAO_Stub *stubobj    ACE_ENV_ARG_DECL throw (CORBA::SystemException) [protected]
 

Helper method that factors out code common to the location_forward() above, and adds the given object reference to the list of a forward profiles.

The forward object reference can be retrieved by invoking the forward_reference() method in this class.

Definition at line 553 of file Invocation.cpp.

References ACE_CHECK, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, and ACE_THROW.

00556 {
00557   // Add the profiles in the given stub object to the list of forward
00558   // profiles.
00559   if (stubobj == 0)
00560     ACE_THROW (CORBA::INTERNAL ());
00561 
00562   // Initialize endpoint selection strategy.
00563   if (this->endpoint_selector_ == 0)
00564     {
00565       this->endpoint_selector_ =
00566         this->orb_core_->endpoint_selector_factory ()->get_selector (
00567           this
00568           ACE_ENV_ARG_PARAMETER);
00569       ACE_CHECK;
00570     }
00571 
00572   // Modify the state as appropriate to include new forwarding
00573   // profiles.
00574   this->endpoint_selector_->forward (this,
00575                                      stubobj->base_profiles ()
00576                                      ACE_ENV_ARG_PARAMETER);
00577   ACE_CHECK;
00578 
00579   this->received_location_forward_ = 1;
00580 
00581   this->restart_flag_ = 1;
00582 }

ACE_INLINE ACE_Time_Value * TAO_GIOP_Invocation::max_wait_time void   
 

Return the current timeout value for the current invocation.

Definition at line 125 of file Invocation.i.

References max_wait_time_.

Referenced by perform_call.

00126 {
00127   return this->max_wait_time_;
00128 }

ACE_INLINE const char * TAO_GIOP_Invocation::operation void   
 

Return the name of the operation being invoked.

Definition at line 24 of file Invocation.i.

References op_details_, and TAO_Operation_Details::opname.

00025 {
00026   return this->op_details_.opname ();
00027 }

ACE_INLINE TAO_ORB_Core * TAO_GIOP_Invocation::orb_core void   
 

ORB_Core Accessor.

Definition at line 107 of file Invocation.i.

References orb_core_.

Referenced by perform_call, TAO_ClientRequestInterceptor_Adapter::send_request, and TAO_ClientRequestInfo_i::setup_picurrent.

00108 {
00109   return this->orb_core_;
00110 }

ACE_INLINE TAO_OutputCDR & TAO_GIOP_Invocation::out_stream void   
 

Return the underlying output stream.

Definition at line 30 of file Invocation.i.

References out_stream_.

Referenced by TAO_Remote_Object_Proxy_Impl::_is_a, CORBA::_TAO_DomainManager_Remote_Proxy_Impl::get_domain_policy, CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Impl::make_domain_manager, and TAO_CORBANAME_Parser::parse_string_dynamic_request_helper.

00031 {
00032   return this->out_stream_;
00033 }

int TAO_GIOP_Invocation::perform_call TAO_Transport_Descriptor_Interface &desc    ACE_ENV_ARG_DECL
 

Called by the invocation endpoint selector for each selected endpoint.

Definition at line 227 of file Invocation.cpp.

References CORBA_SystemException::_tao_minor_code, ACE_CHECK_RETURN, ACE_DEBUG, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TEXT, ACE_THROW_RETURN, TAO_ORB_Core::codeset_manager, TAO_Connector::connect, TAO_ORB_Core::connection_timeout, TAO_ORB_Core::connector_registry, countdown_, ETIME, TAO_Connector_Registry::get_connector, TAO_Transport::is_tcs_set, LM_DEBUG, TAO_GIOP_Message_Version::major, TAO_Transport::make_idle, max_wait_time, TAO_Transport::messaging_init, TAO_GIOP_Message_Version::minor, orb_core, orb_core_, out_stream_, profile_, TAO_Transport::release, ACE_OutputCDR::set_version, TAO_DEFAULT_MINOR_CODE, TAO_TIMEOUT_CONNECT_MINOR_CODE, transport_, ACE_Countdown_Time::update, and TAO_Profile::version.

00229 {
00230   // Get the transport object.
00231   if (this->transport_ != 0)
00232     {
00233       this->transport_->make_idle ();
00234     }
00235 
00236   // Release the transport prior to connecting.
00237   // In most cases the transport_ will already be zero.
00238   TAO_Transport::release (this->transport_);
00239   this->transport_ = 0;
00240 
00241   // Get a pointer to the connector registry, which might be in
00242   // thread-specific storage, depending on the concurrency model.
00243   TAO_Connector_Registry *conn_reg =
00244     this->orb_core_->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER);
00245   ACE_CHECK_RETURN (-1);
00246 
00247   if (conn_reg == 0)
00248     {
00249       ACE_THROW_RETURN (CORBA::INTERNAL (
00250                         CORBA_SystemException::_tao_minor_code (
00251                           TAO_DEFAULT_MINOR_CODE,
00252                           EINVAL),
00253                         CORBA::COMPLETED_NO),
00254                         1);
00255     }
00256 
00257   // Get the max_wait_time
00258   ACE_Time_Value *max_wait_time = 0;
00259 
00260   ACE_Time_Value connection_timeout;
00261   int is_conn_timeout = 0;
00262 
00263   // Check for the connection timout policy in the ORB
00264   this->orb_core ()->connection_timeout (this->stub (),
00265                                          is_conn_timeout,
00266                                          connection_timeout);
00267 
00268   // If a connection timeout policy is set, use that as the timeout
00269   // value.
00270    if (!is_conn_timeout)
00271      max_wait_time =
00272        this->max_wait_time ();
00273    else
00274      max_wait_time = &connection_timeout;
00275 
00276   // Obtain a connection.
00277   int result =
00278     conn_reg->get_connector (desc.endpoint ())->connect (this,
00279                                                          &desc,
00280                                                          max_wait_time
00281                                                          ACE_ENV_ARG_PARAMETER);
00282   ACE_CHECK_RETURN (-1);
00283 
00284   // A timeout error occurred
00285   if (result == -1 && errno == ETIME)
00286     {
00287       // If the user has set a roundtrip timeout policy, then throw a
00288       // timeout exception, else just fall through and return 0 to
00289       // look at the next endpoint
00290       if (!is_conn_timeout)
00291         {
00292           ACE_THROW_RETURN (CORBA::TIMEOUT (
00293               CORBA_SystemException::_tao_minor_code (
00294                 TAO_TIMEOUT_CONNECT_MINOR_CODE,
00295                 errno),
00296               CORBA::COMPLETED_NO),
00297               1);
00298         }
00299     }
00300   else if (result == 0)
00301     {
00302       // Now that we have the client connection handler object we need to
00303       // set the right messaging protocol for in the client side transport.
00304       const TAO_GIOP_Message_Version& version = this->profile_->version ();
00305       result = this->transport_->messaging_init (version.major,
00306                                                  version.minor);
00307 
00308       // Set the giop version of the out stream
00309       this->out_stream_.set_version (version.major, version.minor);
00310 
00311       if (!this->transport_->is_tcs_set())
00312         this->orb_core_->codeset_manager()->
00313           set_tcs(*this->profile_,*this->transport_);
00314 
00315       if (result == -1)
00316         {
00317           if (TAO_debug_level > 0)
00318             {
00319               ACE_DEBUG ((LM_DEBUG,
00320                           ACE_TEXT ("(%N|%l|%p|%t) ")
00321                           ACE_TEXT ("messaging_init() failed\n")));
00322             }
00323         }
00324       else
00325         return 1;
00326     }
00327 
00328   // Update the remaining time for this call.
00329   this->countdown_->update ();
00330 
00331   // Return that we'd like to try another endpoint.
00332   return 0;
00333 }

void TAO_GIOP_Invocation::prepare_header CORBA::Octet response_flags    ACE_ENV_ARG_DECL throw (CORBA::SystemException)
 

Initialize the Request header. The <message_size> field of the GIOP header is left blank and must be filled later.

The function only returns once a connection has been succesfully established *OR* all profiles have been tried. In that case it raises the CORBA::TRANSIENT exception.

Definition at line 336 of file Invocation.cpp.

References ACE_CHECK, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_ERROR, ACE_TEXT, ACE_THROW, TAO_Target_Specification::Key_Addr, LM_ERROR, TAO_Target_Specification::Profile_Addr, and TAO_Target_Specification::Reference_Addr.

Referenced by TAO_Remote_Object_Proxy_Impl::_get_component, TAO_Remote_Object_Proxy_Impl::_is_a, TAO_Remote_Object_Proxy_Impl::_non_existent, CORBA::_TAO_Policy_Remote_Proxy_Impl::copy, CORBA::_TAO_Policy_Remote_Proxy_Impl::destroy, CORBA::_TAO_DomainManager_Remote_Proxy_Impl::get_domain_policy, CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Impl::make_domain_manager, TAO_CORBANAME_Parser::parse_string_dynamic_request_helper, and CORBA::_TAO_Policy_Remote_Proxy_Impl::policy_type.

00339 {
00340   // Then fill in the rest of the RequestHeader
00341 
00342   // Fill up the service context lists
00343   // First lookup at the services to see whether they have anything to
00344   // add to the service context lists
00345   this->orb_core_->service_context_list (this->stub_,
00346                                          this->request_service_context (),
00347                                          this->restart_flag_
00348                                          ACE_ENV_ARG_PARAMETER);
00349   ACE_CHECK;
00350 
00351   // Set the target specification mode
00352   switch (this->profile_->addressing_mode ())
00353     {
00354     case TAO_Target_Specification::Key_Addr:
00355       this->target_spec_.target_specifier (
00356             this->profile_->object_key ());
00357       break;
00358 
00359     case TAO_Target_Specification::Profile_Addr:
00360       this->target_spec_.target_specifier (
00361                 this->profile_->create_tagged_profile ()
00362               );
00363       break;
00364 
00365     case TAO_Target_Specification::Reference_Addr:
00366       // We need to call the method seperately. If there is no
00367       // IOP::IOR info, the call would create the info and return the
00368       // index that we need.
00369       CORBA::ULong index = 0;
00370 
00371       IOP::IOR *ior_info = 0;
00372       int retval = this->stub_->create_ior_info (ior_info,
00373                                                  index
00374                                                  ACE_ENV_ARG_PARAMETER);
00375       ACE_CHECK;
00376 
00377       if (retval == -1)
00378         {
00379           if (TAO_debug_level > 0)
00380             {
00381               ACE_ERROR ((LM_ERROR,
00382                           ACE_TEXT ("TAO (%P|%t) Error in finding index for \n")
00383                           ACE_TEXT ("IOP::IOR \n")));
00384             }
00385           return;
00386         }
00387 
00388       this->target_spec_.target_specifier (*ior_info,
00389                                            index);
00390       break;
00391     }
00392 
00393   // Update the response flags
00394   this->op_details_.response_flags (response_flags);
00395 
00396   // Send the request for the header
00397   if (this->transport_->generate_request_header (this->op_details_,
00398                                                  this->target_spec_,
00399                                                  this->out_stream_)
00400         == -1)
00401     {
00402       ACE_THROW (CORBA::MARSHAL ());
00403     }
00404 
00405   this->transport_->assign_translators (0, &this->out_stream_);
00406 }

ACE_INLINE void TAO_GIOP_Invocation::profile TAO_Profile   p
 

Profile Accessor.

Definition at line 101 of file Invocation.i.

References profile_.

00102 {
00103   this->profile_ = p;
00104 }

ACE_INLINE TAO_Profile * TAO_GIOP_Invocation::profile void   
 

Profile Accessor.

Definition at line 94 of file Invocation.i.

References profile_.

Referenced by TAO_GIOP_Twoway_Invocation::reset_states.

00095 {
00096   return this->profile_;
00097 }

ACE_INLINE CORBA::ULong & TAO_GIOP_Invocation::profile_index void   
 

Definition at line 131 of file Invocation.i.

References profile_index_.

00132 {
00133   return this->profile_index_;
00134 }

ACE_INLINE CORBA::Boolean TAO_GIOP_Invocation::received_location_forward void    const
 

Returns true if a location forward was.

Definition at line 49 of file Invocation.i.

References received_location_forward_.

Referenced by TAO_ClientRequestInfo_i::reply_status.

00050 {
00051   return this->received_location_forward_;
00052 }

ACE_INLINE TAO_Service_Context & TAO_GIOP_Invocation::reply_service_context void   
 

Accessor to the reply ServiceContextList. Only valid when after receiving a reply message.

Definition at line 12 of file Invocation.i.

References op_details_, and TAO_Operation_Details::reply_service_context.

00013 {
00014   return this->op_details_.reply_service_context ();
00015 }

ACE_INLINE CORBA::ULong TAO_GIOP_Invocation::request_id void    const
 

Return the request id of this invocation.

Definition at line 18 of file Invocation.i.

References op_details_, and TAO_Operation_Details::request_id.

00019 {
00020   return this->op_details_.request_id ();
00021 }

ACE_INLINE TAO_Service_Context & TAO_GIOP_Invocation::request_service_context void   
 

Accessor to the request ServiceContextList. Only valid when sending a request message.

Definition at line 6 of file Invocation.i.

References op_details_, and TAO_Operation_Details::request_service_context.

00007 {
00008   return this->op_details_.request_service_context ();
00009 }

ACE_INLINE void TAO_GIOP_Invocation::restart_flag CORBA::Boolean    flag
 

Set the value for the restart flag.

Definition at line 36 of file Invocation.i.

References restart_flag_.

Referenced by CORBA::_TAO_Policy_Remote_Proxy_Impl::copy, CORBA::_TAO_Policy_Remote_Proxy_Impl::destroy, CORBA::_TAO_DomainManager_Remote_Proxy_Impl::get_domain_policy, CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Impl::make_domain_manager, TAO_CORBANAME_Parser::parse_string_dynamic_request_helper, and CORBA::_TAO_Policy_Remote_Proxy_Impl::policy_type.

00037 {
00038   // Set the flag
00039   this->restart_flag_ = flag;
00040 }

void TAO_GIOP_Invocation::start ACE_ENV_SINGLE_ARG_DECL    throw (CORBA::SystemException)
 

Establishes a connection to the remote server, initializes the GIOP headers in the output CDR.

Reimplemented in TAO_GIOP_Asynch_Invocation.

Definition at line 155 of file Invocation.cpp.

References CORBA_SystemException::_tao_minor_code, ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_DECL, ACE_FUNCTION_TIMEPROBE, ACE_THROW, TAO_DEFAULT_MINOR_CODE, and TAO_MINIMAL_TIMEPROBE.

Referenced by TAO_GIOP_Locate_Request_Invocation::start, TAO_GIOP_Oneway_Invocation::start, TAO_GIOP_Twoway_Invocation::start, and TAO_GIOP_Asynch_Invocation::start.

00157 {
00158   ACE_FUNCTION_TIMEPROBE (TAO_GIOP_INVOCATION_START_ENTER);
00159   TAO_MINIMAL_TIMEPROBE (TAO_GIOP_INVOCATION_START_ENTER);
00160 
00161   // First try to bind to the appropriate address.  We do that here
00162   // since we may get forwarded to a different objref in the course of
00163   // any given call, with new start () call each time.  It's not
00164   // cached in the objref data since the connections change
00165   // asynchronously from objref invocations and this simplifies
00166   // connection management.
00167   // We also need to bind *before* marshalling, because different
00168   // Profiles have different ObjectKeys, thus a change of Profile can
00169   // result in different alignment for the buffer.
00170   //
00171   // THREADING NOTE: this connection is reserved to this call.  Also,
00172   // starting at this point in the call, new forwarding information
00173   // will not be used until/unless the call is reissued.  Correctness
00174   // is not affected, the call will just be forwarded later than it
00175   // might be in a more complex implementation.
00176 
00177   // @@ assert is evil, it crashes the program, changed to an
00178   // exception (coryan)
00179   // assert (this->stub_ != 0);
00180 
00181   if (this->stub_ == 0)
00182     {
00183       ACE_THROW (CORBA::INTERNAL (
00184                    CORBA_SystemException::_tao_minor_code (
00185                      TAO_DEFAULT_MINOR_CODE,
00186                      EINVAL),
00187                 CORBA::COMPLETED_NO));
00188     }
00189 
00190   // Initialize endpoint selection strategy.
00191   if (this->endpoint_selector_ == 0)
00192     {
00193       this->endpoint_selector_ =
00194         this->orb_core_->endpoint_selector_factory ()->get_selector (
00195           this
00196           ACE_ENV_ARG_PARAMETER);
00197       ACE_CHECK;
00198     }
00199 
00200   if (this->max_wait_time_ == 0)
00201     {
00202       int has_timeout;
00203       this->orb_core_->call_timeout_hook (this->stub_,
00204                                           has_timeout,
00205                                           this->max_wait_time_value_);
00206       if (has_timeout)
00207         {
00208           this->max_wait_time_ = &this->max_wait_time_value_;
00209         }
00210     }
00211 
00212   ACE_Countdown_Time countdown (this->max_wait_time_);
00213   this->countdown_ = &countdown;
00214 
00215   this->endpoint_selector_->select_endpoint (this
00216                                              ACE_ENV_ARG_PARAMETER);
00217   ACE_CHECK;
00218 
00219   // Set the unique request ID associated with this request.
00220   this->op_details_.request_id (this->transport_->tms ()->request_id ());
00221 
00222   // Make sure that you have the right object key
00223   this->target_spec_.target_specifier (this->profile_->object_key ());
00224 }

ACE_INLINE TAO_Stub * TAO_GIOP_Invocation::stub void   
 

Accessor for the stub associated with this invocation.

Definition at line 75 of file Invocation.i.

References stub_.

Referenced by TAO_Default_Endpoint_Selector::close_connection, TAO_Default_Endpoint_Selector::forward, and TAO_Default_Endpoint_Selector::success.

00076 {
00077   return this->stub_;
00078 }

ACE_INLINE TAO_Transport *& TAO_GIOP_Invocation::transport void   
 

Return the TAO_Transport in use for the current Invocation object.

Definition at line 113 of file Invocation.i.

References transport_.

Referenced by TAO_Connector::connect, and TAO_IIOP_Connector::make_connection.

00114 {
00115   return this->transport_;
00116 }


Member Data Documentation

char TAO_GIOP_Invocation::buffer_[ACE_CDR::DEFAULT_BUFSIZE] [protected]
 

Buffer used for both the output and input CDR streams, this is "safe" because we only one of the streams at a time.

Definition at line 253 of file Invocation.h.

Referenced by TAO_GIOP_Invocation.

ACE_Countdown_Time* TAO_GIOP_Invocation::countdown_ [protected]
 

Keep track of the remaining time for this invocation.

Definition at line 295 of file Invocation.h.

Referenced by perform_call.

TAO_Endpoint* TAO_GIOP_Invocation::endpoint_ [protected]
 

This invocation is using this endpoint from

Parameters:
profile_. 

Definition at line 292 of file Invocation.h.

Referenced by close_connection, and endpoint.

TAO_Invocation_Endpoint_Selector* TAO_GIOP_Invocation::endpoint_selector_ [protected]
 

Strategy for making decisions about which endpoint/profile to use for invocation.

Definition at line 272 of file Invocation.h.

Referenced by close_connection.

CORBA::Object_var TAO_GIOP_Invocation::forward_reference_ [protected]
 

Object reference returned in a LOCATION_FORWARD reply. This reference is only valid when the reply status is TAO_INVOKE_RESTART and

Definition at line 317 of file Invocation.h.

CORBA::PolicyList_var TAO_GIOP_Invocation::inconsistent_policies_ [protected]
 

If current effective policies cause the invocation to raise CORBA::INV_POLICY exception, the conflicting/problematic policies are stored in this list. This is used by

Parameters:
Object::_validate_connection  method to inform clients about causes of invocation failure.

Conflicting policies are only stored in this list if

init_inconsistent_policies  method has been called prior to the beginning of invocation. This saves extra work of conflicting policies 'logging' when it's not needed.

Definition at line 286 of file Invocation.h.

Referenced by get_inconsistent_policies, and inconsistent_policies.

ACE_Time_Value* TAO_GIOP_Invocation::max_wait_time_ [protected]
 

Definition at line 301 of file Invocation.h.

Referenced by max_wait_time.

ACE_Time_Value TAO_GIOP_Invocation::max_wait_time_value_ [protected]
 

Definition at line 300 of file Invocation.h.

TAO_Operation_Details TAO_GIOP_Invocation::op_details_ [protected]
 

The relevant operation detail.

Definition at line 256 of file Invocation.h.

Referenced by operation, reply_service_context, request_id, and request_service_context.

TAO_ORB_Core* TAO_GIOP_Invocation::orb_core_ [protected]
 

The orb_core context where we make this invocation.

Definition at line 264 of file Invocation.h.

Referenced by orb_core, perform_call, and TAO_GIOP_Oneway_Invocation::TAO_GIOP_Oneway_Invocation.

TAO_OutputCDR TAO_GIOP_Invocation::out_stream_ [protected]
 

Stream into which the response is placed.

Definition at line 261 of file Invocation.h.

Referenced by out_stream, and perform_call.

TAO_Profile* TAO_GIOP_Invocation::profile_ [protected]
 

This invocation is using this profile.

Definition at line 289 of file Invocation.h.

Referenced by close_connection, perform_call, and profile.

CORBA::ULong TAO_GIOP_Invocation::profile_index_ [protected]
 

Keep the position of the profile that should be used in performing the invocation.

Definition at line 324 of file Invocation.h.

Referenced by profile_index.

CORBA::Boolean TAO_GIOP_Invocation::received_location_forward_ [protected]
 

Flag is true when a LOCATION_FORWARD reply is received.

Definition at line 320 of file Invocation.h.

Referenced by received_location_forward, and TAO_GIOP_Twoway_Invocation::reset_states.

CORBA::Boolean TAO_GIOP_Invocation::restart_flag_ [protected]
 

This flag is turned on when the previous invocation on an endpoint or a profile returned a TAO_INVOKE_RESTART. FT CORBA relies on this flag for guarenteeing unique id's during reinvocations.

Definition at line 310 of file Invocation.h.

Referenced by TAO_GIOP_Twoway_Invocation::reset_states, and restart_flag.

TAO_Stub* TAO_GIOP_Invocation::stub_ [protected]
 

The object on which this invocation is going.

Definition at line 249 of file Invocation.h.

Referenced by stub.

TAO_Target_Specification TAO_GIOP_Invocation::target_spec_ [protected]
 

Definition at line 258 of file Invocation.h.

TAO_Transport* TAO_GIOP_Invocation::transport_ [protected]
 

This invocation is using this transport.

Note:
may change...

Definition at line 268 of file Invocation.h.

Referenced by close_connection, TAO_GIOP_Synch_Invocation::inp_stream, perform_call, transport, and TAO_GIOP_Synch_Invocation::~TAO_GIOP_Synch_Invocation.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:15:51 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002