Object created by TAO::LocateRequest_Invocation_Adapter to create and send LocateRequest invocation. More...
#include <LocateRequest_Invocation.h>
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. |
Object created by TAO::LocateRequest_Invocation_Adapter to create and send LocateRequest invocation.
Definition at line 40 of file LocateRequest_Invocation.h.
TAO::LocateRequest_Invocation::LocateRequest_Invocation | ( | CORBA::Object_ptr | otarget, | |
Profile_Transport_Resolver & | resolver, | |||
TAO_Operation_Details & | detail | |||
) |
otarget | The target on which this invocation was started. | |
resolver | Container of the profile and transport on which this invocation is on | |
detail | Operation details of the invocation on target. This is of no practical importance since it is not used in this class. This is just to keep our base class happy. |
Definition at line 46 of file LocateRequest_Invocation.cpp.
: transport_ (transport) { this->is_first_ = this->transport_.first_request (); }
Invocation_Status TAO::LocateRequest_Invocation::check_reply | ( | TAO_Synch_Reply_Dispatcher & | rd | ) | [private] |
Helper to check the reply status.
Definition at line 134 of file LocateRequest_Invocation.cpp.
{ TAO_InputCDR &cdr = rd.reply_cdr (); // Set the translators this->resolver_.transport ()->assign_translators (&cdr, 0); switch (rd.locate_reply_status ()) { case GIOP::OBJECT_HERE: break; case GIOP::UNKNOWN_OBJECT: throw ::CORBA::OBJECT_NOT_EXIST (TAO::VMCID, CORBA::COMPLETED_YES); case GIOP::OBJECT_FORWARD: case GIOP::OBJECT_FORWARD_PERM: return this->location_forward (cdr); case GIOP::LOC_SYSTEM_EXCEPTION: { // Pull the exception from the stream. CORBA::String_var buf; if ((cdr >> buf.inout ()) == 0) { // Could not demarshal the exception id, raise a local // CORBA::MARSHAL exception. throw ::CORBA::MARSHAL (TAO::VMCID, CORBA::COMPLETED_MAYBE); } // This kind of exception shouldn't happen with locate requests, // but if it does, we turn it into a CORBA::UNKNOWN exception. throw ::CORBA::UNKNOWN (TAO::VMCID, CORBA::COMPLETED_YES); } case GIOP::LOC_NEEDS_ADDRESSING_MODE: { // We have received an exception with a request to change the // addressing mode. First let us read the mode that the // server/agent asks for. CORBA::Short addr_mode = 0; if (cdr.read_short (addr_mode) == 0) { // Could not demarshal the addressing disposition, raise a local
Invocation_Status TAO::LocateRequest_Invocation::invoke | ( | ACE_Time_Value * | max_wait_time | ) |
Start the invocation.
Definition at line 58 of file LocateRequest_Invocation.cpp.
: Synch_Twoway_Invocation (otarget, resolver, detail) { } Invocation_Status LocateRequest_Invocation::invoke (ACE_Time_Value *max_wait_time) { ACE_Countdown_Time countdown (max_wait_time); TAO_Synch_Reply_Dispatcher *rd_p = 0; ACE_NEW_NORETURN (rd_p, TAO_Synch_Reply_Dispatcher (this->resolver_.stub ()->orb_core (), this->details_.reply_service_info ())); if (!rd_p) { throw ::CORBA::NO_MEMORY (); } ACE_Intrusive_Auto_Ptr<TAO_Synch_Reply_Dispatcher> rd(rd_p, false); // Register a reply dispatcher for this invocation. Use the // preallocated reply dispatcher. TAO_Bind_Dispatcher_Guard dispatch_guard (this->details_.request_id (), rd.get (), this->resolver_.transport ()->tms ()); if (dispatch_guard.status () != 0) { // @@ What is the right way to handle this error? Do we need // to call the interceptors in this case? this->resolver_.transport ()->close_connection (); throw ::CORBA::INTERNAL (TAO::VMCID, CORBA::COMPLETED_NO); } TAO_Transport *transport = this->resolver_.transport (); Invocation_Status s = TAO_INVOKE_FAILURE; { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, transport->output_cdr_lock (), TAO_INVOKE_FAILURE); TAO_OutputCDR &cdr = transport->out_stream (); // This must restore first_request flag after message is sent. First_Request_Guard fr_quard (*transport); TAO_Target_Specification tspec; this->init_target_spec (tspec, cdr); if (transport->generate_locate_request (tspec, this->details_, cdr) == -1) return TAO_INVOKE_FAILURE; countdown.update (); s = this->send_message (cdr, TAO_TWOWAY_REQUEST, max_wait_time); } if (s != TAO_INVOKE_SUCCESS) return s; countdown.update (); // For some strategies one may want to release the transport // back to cache. If the idling is successfull let the // resolver about that.