#include <LocateRequest_Invocation.h>
Inheritance diagram for TAO::LocateRequest_Invocation:


Public Member Functions | |
| LocateRequest_Invocation (CORBA::Object_ptr otarget, Profile_Transport_Resolver &resolver, TAO_Operation_Details &detail) | |
| Invocation_Status | invoke (ACE_Time_Value *max_wait_time) |
| Start the invocation. | |
Private Member Functions | |
| Invocation_Status | check_reply (TAO_Synch_Reply_Dispatcher &rd) |
| Helper to check the reply status. | |
Definition at line 40 of file LocateRequest_Invocation.h.
|
||||||||||||||||
|
Definition at line 23 of file LocateRequest_Invocation.cpp. References CORBA::Object_ptr.
00028 : Synch_Twoway_Invocation (otarget, 00029 resolver, 00030 detail) 00031 { 00032 } |
|
|
Helper to check the reply status.
Definition at line 97 of file LocateRequest_Invocation.cpp. References TAO_Transport::assign_translators(), TAO::String_var< charT >::inout(), TAO::Synch_Twoway_Invocation::location_forward(), TAO::Profile_Transport_Resolver::profile(), ACE_InputCDR::read_short(), TAO_Synch_Reply_Dispatcher::reply_cdr(), TAO_Reply_Dispatcher::reply_status(), CORBA::String_var, TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE, TAO_GIOP_LOC_SYSTEM_EXCEPTION, TAO_GIOP_OBJECT_FORWARD, TAO_GIOP_OBJECT_FORWARD_PERM, TAO_GIOP_OBJECT_HERE, TAO_GIOP_UNKNOWN_OBJECT, TAO::TAO_INVOKE_RESTART, TAO::TAO_INVOKE_SUCCESS, and TAO::Profile_Transport_Resolver::transport(). Referenced by invoke().
00098 {
00099 TAO_InputCDR &cdr = rd.reply_cdr ();
00100
00101 // Set the translators
00102 this->resolver_.transport ()->assign_translators (&cdr, 0);
00103
00104 switch (rd.reply_status ())
00105 {
00106 case TAO_GIOP_OBJECT_HERE:
00107 break;
00108 case TAO_GIOP_UNKNOWN_OBJECT:
00109 throw ::CORBA::OBJECT_NOT_EXIST (TAO::VMCID, CORBA::COMPLETED_YES);
00110 case TAO_GIOP_OBJECT_FORWARD:
00111 case TAO_GIOP_OBJECT_FORWARD_PERM:
00112 return this->location_forward (cdr);
00113
00114 case TAO_GIOP_LOC_SYSTEM_EXCEPTION:
00115 {
00116 // Pull the exception from the stream.
00117 CORBA::String_var buf;
00118
00119 if ((cdr >> buf.inout ()) == 0)
00120 {
00121 // Could not demarshal the exception id, raise a local
00122 // CORBA::MARSHAL exception.
00123 throw ::CORBA::MARSHAL (TAO::VMCID, CORBA::COMPLETED_MAYBE);
00124 }
00125
00126 // This kind of exception shouldn't happen with locate requests,
00127 // but if it does, we turn it into a CORBA::UNKNOWN exception.
00128 throw ::CORBA::UNKNOWN (TAO::VMCID, CORBA::COMPLETED_YES);
00129 }
00130 case TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE:
00131 {
00132 // We have received an exception with a request to change the
00133 // addressing mode. First let us read the mode that the
00134 // server/agent asks for.
00135 CORBA::Short addr_mode = 0;
00136
00137 if (cdr.read_short (addr_mode) == 0)
00138 {
00139 // Could not demarshal the addressing disposition, raise a local
00140 // CORBA::MARSHAL exception.
00141 throw ::CORBA::MARSHAL (TAO::VMCID, CORBA::COMPLETED_MAYBE);
00142 }
00143
00144 // Now set this addressing mode in the profile, so that
00145 // the next invocation need not go through this.
00146 this->resolver_.profile ()->addressing_mode (addr_mode);
00147
00148 // Restart the invocation.
00149 return TAO_INVOKE_RESTART;
00150 }
00151 }
00152
00153 return TAO_INVOKE_SUCCESS;
00154 }
|
|
|
Start the invocation.
Definition at line 35 of file LocateRequest_Invocation.cpp. References check_reply(), TAO_Transport::close_connection(), TAO_Transport::generate_locate_request(), TAO_Transport::idle_after_reply(), TAO_Transport::idle_after_send(), TAO::Remote_Invocation::init_target_spec(), TAO::Invocation_Status, TAO_Transport::out_stream(), TAO_Operation_Details::reply_service_info(), TAO::Remote_Invocation::send_message(), TAO_Bind_Dispatcher_Guard::status(), TAO::TAO_INVOKE_FAILURE, TAO::TAO_INVOKE_SUCCESS, TAO_Transport::tms(), TAO::Profile_Transport_Resolver::transport(), TAO::Profile_Transport_Resolver::transport_released(), ACE_Countdown_Time::update(), and TAO::Synch_Twoway_Invocation::wait_for_reply(). Referenced by TAO::LocateRequest_Invocation_Adapter::invoke().
00036 {
00037 ACE_Countdown_Time countdown (max_wait_time);
00038
00039 TAO_Synch_Reply_Dispatcher rd (this->resolver_.stub ()->orb_core (),
00040 this->details_.reply_service_info ());
00041
00042 // Register a reply dispatcher for this invocation. Use the
00043 // preallocated reply dispatcher.
00044 TAO_Bind_Dispatcher_Guard dispatch_guard (this->details_.request_id (),
00045 &rd,
00046 this->resolver_.transport ()->tms ());
00047
00048 if (dispatch_guard.status () != 0)
00049 {
00050 // @@ What is the right way to handle this error? Do we need
00051 // to call the interceptors in this case?
00052 this->resolver_.transport ()->close_connection ();
00053
00054 throw ::CORBA::INTERNAL (TAO::VMCID, CORBA::COMPLETED_NO);
00055 }
00056
00057 TAO_Target_Specification tspec;
00058 this->init_target_spec (tspec);
00059
00060 TAO_Transport *transport = this->resolver_.transport ();
00061
00062 TAO_OutputCDR &cdr = transport->out_stream ();
00063
00064 if (transport->generate_locate_request (tspec, this->details_, cdr) == -1)
00065 return TAO_INVOKE_FAILURE;
00066
00067 countdown.update ();
00068
00069 Invocation_Status s =
00070 this->send_message (cdr, TAO_Transport::TAO_TWOWAY_REQUEST, max_wait_time);
00071
00072 if (s != TAO_INVOKE_SUCCESS)
00073 return s;
00074
00075 countdown.update ();
00076
00077 // For some strategies one may want to release the transport
00078 // back to cache. If the idling is successfull let the
00079 // resolver about that.
00080 if (this->resolver_.transport ()->idle_after_send ())
00081 this->resolver_.transport_released ();
00082
00083 s = this->wait_for_reply (max_wait_time, rd, dispatch_guard);
00084
00085 s = this->check_reply (rd);
00086
00087 // For some strategies one may want to release the transport
00088 // back to cache after receiving the reply. If the idling is
00089 // successfull let the resolver about that.
00090 if (this->resolver_.transport ()->idle_after_reply ())
00091 this->resolver_.transport_released ();
00092
00093 return s;
00094 }
|
1.3.6