#include <Collocated_Invocation.h>
Inheritance diagram for TAO::Collocated_Invocation:
Public Member Functions | |
Collocated_Invocation (CORBA::Object_ptr t, CORBA::Object_ptr et, TAO_Stub *stub, TAO_Operation_Details &detail, bool response_expected=true) | |
Constructor used by TAO::Invocation_Adapter. | |
Invocation_Status | invoke (Collocation_Proxy_Broker *cpb, Collocation_Strategy strat) |
Private Member Functions | |
Collocated_Invocation (void) |
Definition at line 50 of file Collocated_Invocation.h.
TAO::Collocated_Invocation::Collocated_Invocation | ( | CORBA::Object_ptr | t, | |
CORBA::Object_ptr | et, | |||
TAO_Stub * | stub, | |||
TAO_Operation_Details & | detail, | |||
bool | response_expected = true | |||
) |
Constructor used by TAO::Invocation_Adapter.
t | The target on which invocation first started. | |
et | The effective target in which this invocation is now flowing | |
stub | Stub for effective target et | |
detail | operation details of the invocation including the service context list | |
response_expected | flag to indicate whether the operation encapsulated by detail returns a response or not. |
Definition at line 24 of file Collocated_Invocation.cpp.
00029 : Invocation_Base (t, 00030 et, 00031 stub, 00032 detail, 00033 response_expected, 00034 false /* request_is_remote */ ) 00035 { 00036 }
TAO::Collocated_Invocation::Collocated_Invocation | ( | void | ) | [private] |
Invocation_Status TAO::Collocated_Invocation::invoke | ( | Collocation_Proxy_Broker * | cpb, | |
Collocation_Strategy | strat | |||
) |
Practically this method is a place holder to do the following
Start the interception point
Definition at line 39 of file Collocated_Invocation.cpp.
References TAO_ORB_Core::_incr_refcnt(), CORBA::Object::_stubobj(), TAO_Operation_Details::args(), TAO_Operation_Details::args_num(), CORBA::COMPLETED_MAYBE, TAO::Collocation_Proxy_Broker::dispatch(), CORBA::OMGVMCID, TAO_Operation_Details::opname(), TAO_Operation_Details::opname_len(), TAO_Pseudo_Var_T< T >::out(), TAO_ORB_Core::request_dispatcher(), TAO_Stub::servant_orb_ptr(), TAO::TAO_CS_THRU_POA_STRATEGY, TAO_INTERCEPTOR, TAO::TAO_INVOKE_FAILURE, TAO::TAO_INVOKE_RESTART, and TAO::TAO_INVOKE_SUCCESS.
00041 { 00042 Invocation_Status s = TAO_INVOKE_FAILURE; 00043 00044 /// Start the interception point 00045 #if TAO_HAS_INTERCEPTORS == 1 00046 s = this->send_request_interception (); 00047 00048 if (s != TAO_INVOKE_SUCCESS) 00049 return s; 00050 #endif /*TAO_HAS_INTERCEPTORS */ 00051 00052 try 00053 { 00054 if (strat == TAO_CS_THRU_POA_STRATEGY) 00055 { 00056 // Perform invocations on the servant through the servant's ORB. 00057 CORBA::ORB_var servant_orb = 00058 this->effective_target ()->_stubobj ()->servant_orb_ptr (); 00059 TAO_ORB_Core * const orb_core = servant_orb->orb_core (); 00060 00061 TAO_ServerRequest request (orb_core, 00062 this->details_, 00063 this->effective_target ()); 00064 00065 TAO_Request_Dispatcher * const dispatcher = 00066 orb_core->request_dispatcher (); 00067 00068 // Retain ownership of the servant's ORB_Core in case 00069 // another thread attempts to destroy it (e.g. via 00070 // CORBA::ORB::destroy()) before this thread complete the 00071 // invocation. 00072 orb_core->_incr_refcnt (); 00073 TAO_ORB_Core_Auto_Ptr my_orb_core (orb_core); 00074 00075 dispatcher->dispatch (orb_core, 00076 request, 00077 this->forwarded_to_.out ()); 00078 00079 if (request.is_forwarded ()) 00080 { 00081 this->reply_status_ = GIOP::LOCATION_FORWARD; 00082 } 00083 } 00084 else 00085 { 00086 bool is_forwarded = false; 00087 00088 cpb->dispatch (this->effective_target (), 00089 this->forwarded_to_.out (), 00090 is_forwarded, 00091 this->details_.args (), 00092 this->details_.args_num (), 00093 this->details_.opname (), 00094 this->details_.opname_len (), 00095 strat); 00096 00097 if (is_forwarded) 00098 { 00099 this->reply_status_ = GIOP::LOCATION_FORWARD; 00100 } 00101 } 00102 00103 // Invocation completed succesfully 00104 s = TAO_INVOKE_SUCCESS; 00105 00106 #if TAO_HAS_INTERCEPTORS == 1 00107 if (this->reply_status_ == GIOP::LOCATION_FORWARD || 00108 this->response_expected_ == false) 00109 { 00110 if (this->reply_status_ == GIOP::LOCATION_FORWARD) 00111 this->invoke_status (TAO_INVOKE_RESTART); 00112 00113 s = this->receive_other_interception (); 00114 } 00115 // NOTE: Any other condition that needs handling? 00116 else if (this->response_expected ()) 00117 { 00118 this->invoke_status (TAO_INVOKE_SUCCESS); 00119 00120 s = this->receive_reply_interception (); 00121 } 00122 if (s != TAO_INVOKE_SUCCESS) 00123 return s; 00124 #endif /*TAO_HAS_INTERCEPTORS */ 00125 } 00126 catch ( ::CORBA::UserException& ex) 00127 { 00128 // Ignore CORBA exceptions for oneways 00129 if (this->response_expected_ == false) 00130 return TAO_INVOKE_SUCCESS; 00131 00132 #if TAO_HAS_INTERCEPTORS == 1 00133 PortableInterceptor::ReplyStatus const status = 00134 this->handle_any_exception (&ex); 00135 00136 if (status == PortableInterceptor::LOCATION_FORWARD || 00137 status == PortableInterceptor::TRANSPORT_RETRY) 00138 s = TAO_INVOKE_RESTART; 00139 else 00140 #endif /* TAO_HAS_INTERCEPTORS */ 00141 { 00142 // Check whether the user exception thrown matches the signature 00143 // list, if not, then throw an Unknown exception 00144 if (!this->details_.has_exception (ex)) 00145 { 00146 throw ::CORBA::UNKNOWN (CORBA::OMGVMCID | 1, 00147 CORBA::COMPLETED_MAYBE); 00148 } 00149 else 00150 { 00151 throw; 00152 } 00153 } 00154 } 00155 catch ( ::CORBA::SystemException& TAO_INTERCEPTOR (ex)) 00156 { 00157 // Ignore CORBA exceptions for oneways 00158 if (this->response_expected_ == false) 00159 return TAO_INVOKE_SUCCESS; 00160 00161 #if TAO_HAS_INTERCEPTORS == 1 00162 PortableInterceptor::ReplyStatus const status = 00163 this->handle_any_exception (&ex); 00164 00165 if (status == PortableInterceptor::LOCATION_FORWARD || 00166 status == PortableInterceptor::TRANSPORT_RETRY) 00167 s = TAO_INVOKE_RESTART; 00168 else 00169 #endif /* TAO_HAS_INTERCEPTORS */ 00170 throw; 00171 } 00172 #if TAO_HAS_INTERCEPTORS == 1 00173 catch (...) 00174 { 00175 // Notify interceptors of non-CORBA exception, and propagate 00176 // that exception to the caller. 00177 PortableInterceptor::ReplyStatus const st = 00178 this->handle_all_exception (); 00179 00180 if (st == PortableInterceptor::LOCATION_FORWARD || 00181 st == PortableInterceptor::TRANSPORT_RETRY) 00182 s = TAO_INVOKE_RESTART; 00183 else 00184 throw; 00185 } 00186 #endif /* TAO_HAS_INTERCEPTORS == 1 */ 00187 00188 if (this->reply_status_ == GIOP::LOCATION_FORWARD) 00189 s = TAO_INVOKE_RESTART; 00190 00191 return s; 00192 }