This is the main class for DSI using AMH. More...
#include <AMH_DSI_Response_Handler.h>
This is the main class for DSI using AMH.
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.
Useful for template programming.
Reimplemented from CORBA::LocalObject.
Definition at line 213 of file AMH_DSI_Response_Handler.h.
Reimplemented from CORBA::LocalObject.
Definition at line 214 of file AMH_DSI_Response_Handler.h.
TAO_AMH_DSI_Response_Handler::TAO_AMH_DSI_Response_Handler | ( | TAO_ServerRequest & | sr | ) |
Definition at line 306 of file AMH_DSI_Response_Handler.cpp.
: TAO_AMH_Response_Handler (), orb_core_ (sr.orb_core ()) { }
TAO_AMH_DSI_Response_Handler::~TAO_AMH_DSI_Response_Handler | ( | void | ) |
Definition at line 313 of file AMH_DSI_Response_Handler.cpp.
{ }
void * TAO_AMH_DSI_Response_Handler::_downcast | ( | const char * | repository_id | ) | [protected, virtual] |
Simply returns "this".
Definition at line 454 of file AMH_DSI_Response_Handler.cpp.
{ return this; }
TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_duplicate | ( | TAO_AMH_DSI_Response_Handler_ptr | x | ) | [static] |
CORBA Object related methods.
Definition at line 7 of file AMH_DSI_Response_Handler.inl.
{ if (x != 0) { x->_add_ref (); } return x; }
const char * TAO_AMH_DSI_Response_Handler::_interface_repository_id | ( | void | ) | const [protected, virtual] |
Return 0. Should never be used.
Reimplemented from CORBA::Object.
Definition at line 475 of file AMH_DSI_Response_Handler.cpp.
{
return 0;
}
TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_narrow | ( | CORBA::Object_ptr | obj | ) | [static] |
is_local
member into CORBA::Object. I'll take the easier route for now. Reimplemented from CORBA::LocalObject.
Definition at line 460 of file AMH_DSI_Response_Handler.cpp.
{ return TAO_AMH_DSI_Response_Handler::_unchecked_narrow (obj); }
TAO_AMH_DSI_Response_Handler_ptr TAO_AMH_DSI_Response_Handler::_nil | ( | void | ) | [static] |
Return a NIL object.
Reimplemented from CORBA::LocalObject.
Definition at line 300 of file AMH_DSI_Response_Handler.cpp.
{ return (TAO_AMH_DSI_Response_Handler_ptr) 0; }
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 | obj | ) | [static] |
Definition at line 466 of file AMH_DSI_Response_Handler.cpp.
{ if (CORBA::is_nil (obj)) return TAO_AMH_DSI_Response_Handler::_nil (); return dynamic_cast < TAO_AMH_DSI_Response_Handler_ptr > (obj); }
void TAO_AMH_DSI_Response_Handler::gateway_exception_reply | ( | CORBA::ULong | reply_status, | |
TAO_InputCDR & | encap | |||
) | [virtual] |
Definition at line 409 of file AMH_DSI_Response_Handler.cpp.
{ // for this to be effective, ACE & TAO must be built with // ACE_ENABLE_SWAP_ON_WRITE defined in ace/config.h this->_tao_out.reset_byte_order(encap.byte_order()); // This reply path handles only user exceptions. switch (reply_status) { //case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION: case TAO_AMI_REPLY_USER_EXCEPTION: this->reply_status_ = GIOP::USER_EXCEPTION; break; case TAO_AMI_REPLY_SYSTEM_EXCEPTION: this->reply_status_ = GIOP::SYSTEM_EXCEPTION; break; // we don't handle location forward at this moment. // need to be addressed later. // //case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD: // this->exception_type_ = TAO_GIOP_LOCATION_FORWARD; // break; } try { this->_tao_rh_init_reply (); // We know nothing about this exception, so we marshal it as a block // of bytes. The outgoing stream's byte order has already been matched // to the original source of the reply. this->_tao_out.write_octet_array_mb (encap.start()); // This will prevent the marshaling of any parameters into this reply. // this->sent_gateway_exception_ = 1; this->_tao_rh_send_reply (); } catch (const CORBA::Exception &) { // TODO: } }
void TAO_AMH_DSI_Response_Handler::gateway_exception_reply | ( | CORBA::ULong | reply_status, | |
TAO_OutputCDR & | encap | |||
) | [virtual] |
Definition at line 365 of file AMH_DSI_Response_Handler.cpp.
{ // for this to be effective, ACE & TAO must be built with // ACE_ENABLE_SWAP_ON_WRITE defined in ace/config.h this->_tao_out.reset_byte_order (encap.byte_order ()); // This reply path handles only user exceptions. switch (reply_status) { case TAO_AMI_REPLY_USER_EXCEPTION: this->reply_status_ = GIOP::USER_EXCEPTION; break; case TAO_AMI_REPLY_SYSTEM_EXCEPTION: this->reply_status_ = GIOP::SYSTEM_EXCEPTION; break; // TODO: we don't handle location forward at this moment. // need to be addressed later. // //case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD: // this->exception_type_ = TAO_GIOP_LOCATION_FORWARD; // break; } try { this->_tao_rh_init_reply (); // We know nothing about this exception, so we marshal it as a block // of bytes. The outgoing stream's byte order has already been matched // to the original source of the reply. this->_tao_out.write_char_array (encap.buffer (), encap.length ()); // This will prevent the marshaling of any parameters into this reply. // this->sent_gateway_exception_ = 1; this->_tao_rh_send_reply (); } catch (const CORBA::Exception &) { // TODO: } }
void TAO_AMH_DSI_Response_Handler::invoke_excep | ( | TAO_AMH_DSI_Exception_Holder * | h | ) | [virtual] |
Definition at line 345 of file AMH_DSI_Response_Handler.cpp.
{ try { h->raise_invoke (); } catch (const CORBA::Exception & ex) { this->_tao_rh_send_exception (ex); } }
void TAO_AMH_DSI_Response_Handler::invoke_location_forward | ( | CORBA::Object_ptr | fwd, | |
CORBA::Boolean | is_perm | |||
) | [virtual] |
Definition at line 358 of file AMH_DSI_Response_Handler.cpp.
{ this->_tao_rh_send_location_forward (fwd,is_perm); }
void TAO_AMH_DSI_Response_Handler::invoke_reply | ( | CORBA::NVList_ptr | args, | |
CORBA::NamedValue_ptr | result | |||
) | [virtual] |
Definition at line 318 of file AMH_DSI_Response_Handler.cpp.
{ try { this->_tao_rh_init_reply (); // Send the return value, if any. if (result != 0 && result->value () != 0) { result->value ()->impl ()->marshal_value (this->_tao_out); } // Send the "inout" and "out" parameters. if (args != 0) { args->_tao_encode (this->_tao_out, CORBA::ARG_INOUT | CORBA::ARG_OUT); } this->_tao_rh_send_reply (); } catch (const CORBA::Exception &) { // TODO: } }
A pointer to the ORB Core for the context where the request was created.
Reimplemented from TAO_AMH_Response_Handler.
Definition at line 252 of file AMH_DSI_Response_Handler.h.