#include <DII_Reply_Dispatcher.h>
Inheritance diagram for TAO_DII_Deferred_Reply_Dispatcher:
Public Member Functions | |
TAO_DII_Deferred_Reply_Dispatcher (const CORBA::Request_ptr req, TAO_ORB_Core *orb_core) | |
virtual int | dispatch_reply (TAO_Pluggable_Reply_Params ¶m) |
The Reply_Dispatcher methods. | |
virtual void | connection_closed (void) |
virtual void | reply_timed_out (void) |
The following methods are not needed for this class.. | |
virtual long | schedule_timer (CORBA::ULong, const ACE_Time_Value &) |
Protected Member Functions | |
~TAO_DII_Deferred_Reply_Dispatcher (void) | |
Destructor. | |
Private Attributes | |
const CORBA::Request_ptr | req_ |
Where the reply needs to go. |
Definition at line 47 of file DII_Reply_Dispatcher.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_DII_Deferred_Reply_Dispatcher::TAO_DII_Deferred_Reply_Dispatcher | ( | const CORBA::Request_ptr | req, | |
TAO_ORB_Core * | orb_core | |||
) |
Definition at line 18 of file DII_Reply_Dispatcher.cpp.
00021 : TAO_Asynch_Reply_Dispatcher_Base (orb_core) 00022 , req_ (req) 00023 { 00024 }
TAO_DII_Deferred_Reply_Dispatcher::~TAO_DII_Deferred_Reply_Dispatcher | ( | void | ) | [protected] |
void TAO_DII_Deferred_Reply_Dispatcher::connection_closed | ( | void | ) | [virtual] |
Implements TAO_Asynch_Reply_Dispatcher_Base.
Definition at line 99 of file DII_Reply_Dispatcher.cpp.
References CORBA::COMPLETED_MAYBE, CORBA::Request::handle_response(), req_, SYSTEM_EXCEPTION, and TAO_debug_level.
00100 { 00101 00102 try 00103 { 00104 // Generate a fake exception.... 00105 CORBA::COMM_FAILURE comm_failure (0, CORBA::COMPLETED_MAYBE); 00106 00107 TAO_OutputCDR out_cdr; 00108 00109 comm_failure._tao_encode (out_cdr); 00110 00111 // Turn into an output CDR 00112 TAO_InputCDR cdr (out_cdr); 00113 00114 this->req_->handle_response (cdr, GIOP::SYSTEM_EXCEPTION); 00115 } 00116 catch (const ::CORBA::Exception& ex) 00117 { 00118 if (TAO_debug_level >= 4) 00119 { 00120 ex._tao_print_exception ( 00121 "DII_Deferred_Reply_Dispacher::connection_closed"); 00122 } 00123 } 00124 00125 (void) this->decr_refcount (); 00126 }
int TAO_DII_Deferred_Reply_Dispatcher::dispatch_reply | ( | TAO_Pluggable_Reply_Params & | param | ) | [virtual] |
The Reply_Dispatcher methods.
Implements TAO_Asynch_Reply_Dispatcher_Base.
Definition at line 33 of file DII_Reply_Dispatcher.cpp.
References ACE_BIT_DISABLED, ACE_DEBUG, ACE_ERROR, ACE_TEXT, ACE_InputCDR::clone_from(), ACE_Message_Block::DONT_DELETE, ACE_Data_Block::flags(), CORBA::Request::handle_response(), TAO_Pluggable_Reply_Params::input_cdr_, LM_DEBUG, LM_ERROR, TAO_Pluggable_Reply_Params_Base::locate_reply_status(), TAO_Reply_Dispatcher::locate_reply_status_, ACE_Data_Block::release(), TAO_Asynch_Reply_Dispatcher_Base::reply_cdr_, TAO_Asynch_Reply_Dispatcher_Base::reply_service_info_, TAO_Pluggable_Reply_Params_Base::reply_status(), TAO_Reply_Dispatcher::reply_status_, req_, TAO_Pluggable_Reply_Params_Base::svc_ctx_, and TAO_debug_level.
00035 { 00036 if (params.input_cdr_ == 0) 00037 return -1; 00038 00039 this->reply_status_ = params.reply_status (); 00040 this->locate_reply_status_ = params.locate_reply_status (); 00041 00042 // Transfer the <params.input_cdr_>'s content to this->reply_cdr_ 00043 ACE_Data_Block *db = this->reply_cdr_.clone_from (*params.input_cdr_); 00044 00045 if (db == 0) 00046 { 00047 if (TAO_debug_level > 2) 00048 { 00049 ACE_ERROR (( 00050 LM_ERROR, 00051 "TAO (%P|%t) - DII_Deferred_Reply_Dispatcher::dispatch_reply " 00052 "clone_from failed \n")); 00053 } 00054 return -1; 00055 } 00056 00057 // See whether we need to delete the data block by checking the 00058 // flags. We cannot be happy that we initally allocated the 00059 // datablocks of the stack. If this method is called twice, as is in 00060 // some cases where the same invocation object is used to make two 00061 // invocations like forwarding, the release becomes essential. 00062 if (ACE_BIT_DISABLED (db->flags (), 00063 ACE_Message_Block::DONT_DELETE)) 00064 db->release (); 00065 00066 // Steal the buffer, that way we don't do any unnecesary copies of 00067 // this data. 00068 CORBA::ULong max = params.svc_ctx_.maximum (); 00069 CORBA::ULong len = params.svc_ctx_.length (); 00070 IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (1); 00071 this->reply_service_info_.replace (max, len, context_list, 1); 00072 00073 if (TAO_debug_level >= 4) 00074 { 00075 ACE_DEBUG ((LM_DEBUG, 00076 ACE_TEXT ("(%P | %t):TAO_Asynch_Reply_Dispatcher::dispatch_reply:\n"))); 00077 } 00078 00079 try 00080 { 00081 // Call the Request back and send the reply data. 00082 this->req_->handle_response (this->reply_cdr_, this->reply_status_); 00083 } 00084 catch (const ::CORBA::Exception& ex) 00085 { 00086 if (TAO_debug_level >= 4) 00087 { 00088 ex._tao_print_exception ("Exception during reply handler"); 00089 } 00090 } 00091 00092 // This was dynamically allocated. Now the job is done. 00093 (void) this->decr_refcount (); 00094 00095 return 1; 00096 }
virtual void TAO_DII_Deferred_Reply_Dispatcher::reply_timed_out | ( | void | ) | [inline, virtual] |
The following methods are not needed for this class..
Implements TAO_Asynch_Reply_Dispatcher_Base.
Definition at line 62 of file DII_Reply_Dispatcher.h.
virtual long TAO_DII_Deferred_Reply_Dispatcher::schedule_timer | ( | CORBA::ULong | , | |
const ACE_Time_Value & | ||||
) | [inline, virtual] |
const CORBA::Request_ptr TAO_DII_Deferred_Reply_Dispatcher::req_ [private] |
Where the reply needs to go.
Definition at line 74 of file DII_Reply_Dispatcher.h.
Referenced by connection_closed(), and dispatch_reply().