#include <AMH_DSI_Response_Handler.h>
Collaboration diagram for TAO_AMH_DSI_Response_Handler:
With ordinary DSI, the POA calls _dispatch, which in turn calls invoke on the DSI handler. Invoke completely handles the request, and packages the result in the request object so that it can be marshalled and sent back to the caller.
With the AMH variation, the DSI handler's invoke method starts the processing, but delegates the result packaging to a response handler. This way, if the invocation takes a long time, or involves blocking calls, then the result handling can be managed by another thread. This is particularly useful for gateway implementations, where the middle tier should not have to block waiting for replies.
As this is built on the CORBA object model, there are separate classes representing the interface and the implementation.
Definition at line 209 of file AMH_DSI_Response_Handler.h.
Definition at line 213 of file AMH_DSI_Response_Handler.h.
Definition at line 214 of file AMH_DSI_Response_Handler.h.
TAO_AMH_DSI_Response_Handler::TAO_AMH_DSI_Response_Handler | ( | TAO_ServerRequest & | sr | ) |
TAO_AMH_DSI_Response_Handler::~TAO_AMH_DSI_Response_Handler | ( | void | ) |
void * TAO_AMH_DSI_Response_Handler::_downcast | ( | const char * | repository_id | ) | [protected, virtual] |
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_duplicate | ( | TAO_AMH_DSI_Response_Handler_ptr | ) | [static] |
CORBA Object related methods.
Definition at line 7 of file AMH_DSI_Response_Handler.inl.
Referenced by TAO_AMH_DSI_Response_Handler_var::operator=().
const char * TAO_AMH_DSI_Response_Handler::_interface_repository_id | ( | void | ) | const [protected, virtual] |
TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_narrow | ( | CORBA::Object_ptr | ) | [static] |
Definition at line 464 of file AMH_DSI_Response_Handler.cpp.
References _unchecked_narrow().
00465 { 00466 return TAO_AMH_DSI_Response_Handler::_unchecked_narrow (obj); 00467 }
TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_nil | ( | void | ) | [static] |
Definition at line 304 of file AMH_DSI_Response_Handler.cpp.
Referenced by TAO_AMH_DSI_Response_Handler_var::_retn(), _unchecked_narrow(), and TAO_AMH_DSI_Response_Handler_var::out().
00305 { 00306 return (TAO_AMH_DSI_Response_Handler_ptr) 0; 00307 }
CORBA::Object_ptr TAO_AMH_DSI_Response_Handler::_this | ( | ) |
Returns a CORBA::Object_ptr for the target object.
TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_unchecked_narrow | ( | CORBA::Object_ptr | ) | [static] |
Definition at line 470 of file AMH_DSI_Response_Handler.cpp.
References _nil(), and CORBA::is_nil().
Referenced by _narrow().
00471 { 00472 if (CORBA::is_nil (obj)) 00473 return TAO_AMH_DSI_Response_Handler::_nil (); 00474 00475 return dynamic_cast < TAO_AMH_DSI_Response_Handler_ptr > (obj); 00476 }
void TAO_AMH_DSI_Response_Handler::gateway_exception_reply | ( | CORBA::ULong | reply_status, | |
TAO_InputCDR & | encap | |||
) | [virtual] |
Definition at line 413 of file AMH_DSI_Response_Handler.cpp.
References ACE_InputCDR::byte_order(), ACE_InputCDR::start(), SYSTEM_EXCEPTION, and USER_EXCEPTION.
00416 { 00417 // for this to be effective, ACE & TAO must be built with 00418 // ACE_ENABLE_SWAP_ON_WRITE defined in ace/config.h 00419 this->_tao_out.reset_byte_order(encap.byte_order()); 00420 // This reply path handles only user exceptions. 00421 switch (reply_status) 00422 { 00423 //case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION: 00424 case TAO_AMI_REPLY_USER_EXCEPTION: 00425 this->reply_status_ = GIOP::USER_EXCEPTION; 00426 break; 00427 case TAO_AMI_REPLY_SYSTEM_EXCEPTION: 00428 this->reply_status_ = GIOP::SYSTEM_EXCEPTION; 00429 break; 00430 00431 // we don't handle location forward at this moment. 00432 // need to be addressed later. 00433 // 00434 //case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD: 00435 // this->exception_type_ = TAO_GIOP_LOCATION_FORWARD; 00436 // break; 00437 } 00438 try 00439 { 00440 this->_tao_rh_init_reply (); 00441 00442 // We know nothing about this exception, so we marshal it as a block 00443 // of bytes. The outgoing stream's byte order has already been matched 00444 // to the original source of the reply. 00445 this->_tao_out.write_octet_array_mb (encap.start()); 00446 // This will prevent the marshaling of any parameters into this reply. 00447 // this->sent_gateway_exception_ = 1; 00448 this->_tao_rh_send_reply (); 00449 } 00450 catch (const CORBA::Exception &) 00451 { 00452 // TODO: 00453 } 00454 00455 }
void TAO_AMH_DSI_Response_Handler::gateway_exception_reply | ( | CORBA::ULong | reply_status, | |
TAO_OutputCDR & | encap | |||
) | [virtual] |
Definition at line 369 of file AMH_DSI_Response_Handler.cpp.
References ACE_OutputCDR::buffer(), ACE_OutputCDR::byte_order(), ACE_OutputCDR::length(), SYSTEM_EXCEPTION, and USER_EXCEPTION.
00372 { 00373 // for this to be effective, ACE & TAO must be built with 00374 // ACE_ENABLE_SWAP_ON_WRITE defined in ace/config.h 00375 this->_tao_out.reset_byte_order (encap.byte_order ()); 00376 // This reply path handles only user exceptions. 00377 switch (reply_status) 00378 { 00379 case TAO_AMI_REPLY_USER_EXCEPTION: 00380 this->reply_status_ = GIOP::USER_EXCEPTION; 00381 break; 00382 case TAO_AMI_REPLY_SYSTEM_EXCEPTION: 00383 this->reply_status_ = GIOP::SYSTEM_EXCEPTION; 00384 break; 00385 00386 // TODO: we don't handle location forward at this moment. 00387 // need to be addressed later. 00388 // 00389 //case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD: 00390 // this->exception_type_ = TAO_GIOP_LOCATION_FORWARD; 00391 // break; 00392 } 00393 try 00394 { 00395 this->_tao_rh_init_reply (); 00396 00397 // We know nothing about this exception, so we marshal it as a block 00398 // of bytes. The outgoing stream's byte order has already been matched 00399 // to the original source of the reply. 00400 this->_tao_out.write_char_array (encap.buffer (), encap.length ()); 00401 // This will prevent the marshaling of any parameters into this reply. 00402 // this->sent_gateway_exception_ = 1; 00403 this->_tao_rh_send_reply (); 00404 } 00405 catch (const CORBA::Exception &) 00406 { 00407 // TODO: 00408 } 00409 00410 }
void TAO_AMH_DSI_Response_Handler::invoke_excep | ( | TAO_AMH_DSI_Exception_Holder * | h | ) | [virtual] |
Definition at line 349 of file AMH_DSI_Response_Handler.cpp.
References TAO_AMH_DSI_Exception_Holder::raise_invoke().
00350 { 00351 try 00352 { 00353 h->raise_invoke (); 00354 } 00355 catch (const CORBA::Exception & ex) 00356 { 00357 this->_tao_rh_send_exception (ex); 00358 } 00359 }
void TAO_AMH_DSI_Response_Handler::invoke_location_forward | ( | CORBA::Object_ptr | fwd, | |
CORBA::Boolean | is_perm | |||
) | [virtual] |
void TAO_AMH_DSI_Response_Handler::invoke_reply | ( | CORBA::NVList_ptr | args, | |
CORBA::NamedValue_ptr | result | |||
) | [virtual] |
Definition at line 322 of file AMH_DSI_Response_Handler.cpp.
00324 { 00325 try 00326 { 00327 this->_tao_rh_init_reply (); 00328 00329 // Send the return value, if any. 00330 if (result != 0 && result->value () != 0) 00331 { 00332 result->value ()->impl ()->marshal_value (this->_tao_out); 00333 } 00334 00335 // Send the "inout" and "out" parameters. 00336 if (args != 0) 00337 { 00338 args->_tao_encode (this->_tao_out, CORBA::ARG_INOUT | CORBA::ARG_OUT); 00339 } 00340 this->_tao_rh_send_reply (); 00341 } 00342 catch (const CORBA::Exception &) 00343 { 00344 // TODO: 00345 } 00346 }
Definition at line 252 of file AMH_DSI_Response_Handler.h.