#include <DII_Reply_Dispatcher.h>
Inheritance diagram for TAO_DII_Asynch_Reply_Dispatcher:
Public Member Functions | |
TAO_DII_Asynch_Reply_Dispatcher (const Messaging::ReplyHandler_ptr callback, TAO_ORB_Core *orb_core) | |
virtual | ~TAO_DII_Asynch_Reply_Dispatcher (void) |
virtual int | dispatch_reply (TAO_Pluggable_Reply_Params ¶m) |
The Reply_Dispatcher methods. | |
virtual void | connection_closed (void) |
Private Attributes | |
char | buf_ [ACE_CDR::DEFAULT_BUFSIZE] |
The buffer that is used to initialise the data block. | |
ACE_Data_Block | db_ |
TAO_InputCDR | reply_cdr_ |
CDR stream for reading the input. | |
const Messaging::ReplyHandler_ptr | callback_ |
Where the reply needs to go. |
Definition at line 83 of file DII_Reply_Dispatcher.h.
TAO_DII_Asynch_Reply_Dispatcher::TAO_DII_Asynch_Reply_Dispatcher | ( | const Messaging::ReplyHandler_ptr | callback, | |
TAO_ORB_Core * | orb_core | |||
) |
Definition at line 128 of file DII_Reply_Dispatcher.cpp.
00131 : TAO_Asynch_Reply_Dispatcher_Base (orb_core), 00132 db_ (sizeof buf_, 00133 ACE_Message_Block::MB_DATA, 00134 this->buf_, 00135 orb_core->input_cdr_buffer_allocator (), 00136 orb_core->locking_strategy (), 00137 ACE_Message_Block::DONT_DELETE, 00138 orb_core->input_cdr_dblock_allocator ()), 00139 reply_cdr_ (&db_, 00140 ACE_Message_Block::DONT_DELETE, 00141 TAO_ENCAP_BYTE_ORDER, 00142 TAO_DEF_GIOP_MAJOR, 00143 TAO_DEF_GIOP_MINOR, 00144 orb_core), 00145 callback_ (callback) 00146 { 00147 }
TAO_DII_Asynch_Reply_Dispatcher::~TAO_DII_Asynch_Reply_Dispatcher | ( | void | ) | [virtual] |
Definition at line 149 of file DII_Reply_Dispatcher.cpp.
References callback_, and CORBA::release().
00150 { 00151 // this was handed to us by the caller. 00152 CORBA::release(callback_); 00153 }
void TAO_DII_Asynch_Reply_Dispatcher::connection_closed | ( | void | ) | [virtual] |
Implements TAO_Asynch_Reply_Dispatcher_Base.
Definition at line 211 of file DII_Reply_Dispatcher.cpp.
References CORBA::Exception::_tao_print_exception(), CORBA::Request::_tao_reply_stub(), CORBA::COMPLETED_MAYBE, SYSTEM_EXCEPTION, and TAO_debug_level.
00212 { 00213 try 00214 { 00215 // Generate a fake exception.... 00216 CORBA::COMM_FAILURE comm_failure (0, 00217 CORBA::COMPLETED_MAYBE); 00218 00219 TAO_OutputCDR out_cdr; 00220 00221 comm_failure._tao_encode (out_cdr); 00222 00223 // Turn into an output CDR 00224 TAO_InputCDR cdr (out_cdr); 00225 CORBA::Request::_tao_reply_stub ( 00226 this->reply_cdr_, 00227 this->callback_, 00228 GIOP::SYSTEM_EXCEPTION); 00229 } 00230 catch (const CORBA::Exception& ex) 00231 { 00232 if (TAO_debug_level >= 4) 00233 { 00234 ex._tao_print_exception ( 00235 "DII_Asynch_Reply_Dispacher::connection_closed"); 00236 } 00237 } 00238 00239 (void) this->decr_refcount (); 00240 }
int TAO_DII_Asynch_Reply_Dispatcher::dispatch_reply | ( | TAO_Pluggable_Reply_Params & | param | ) | [virtual] |
The Reply_Dispatcher methods.
Implements TAO_Asynch_Reply_Dispatcher_Base.
Definition at line 156 of file DII_Reply_Dispatcher.cpp.
References CORBA::Exception::_tao_print_exception(), CORBA::Request::_tao_reply_stub(), ACE_BIT_DISABLED, ACE_DEBUG, ACE_TEXT, ACE_InputCDR::clone_from(), ACE_Message_Block::DONT_DELETE, ACE_Data_Block::flags(), TAO_Pluggable_Reply_Params::input_cdr_, LM_DEBUG, TAO_Pluggable_Reply_Params_Base::locate_reply_status(), TAO_Reply_Dispatcher::locate_reply_status_, ACE_Data_Block::release(), reply_cdr_, TAO_Asynch_Reply_Dispatcher_Base::reply_service_info_, TAO_Pluggable_Reply_Params_Base::reply_status(), TAO_Reply_Dispatcher::reply_status_, TAO_Pluggable_Reply_Params_Base::svc_ctx_, and TAO_debug_level.
00158 { 00159 this->reply_status_ = params.reply_status (); 00160 this->locate_reply_status_ = params.locate_reply_status (); 00161 00162 // Transfer the <params.input_cdr_>'s content to this->reply_cdr_ 00163 ACE_Data_Block *db = 00164 this->reply_cdr_.clone_from (*params.input_cdr_); 00165 00166 // See whether we need to delete the data block by checking the 00167 // flags. We cannot be happy that we initally allocated the 00168 // datablocks of the stack. If this method is called twice, as is in 00169 // some cases where the same invocation object is used to make two 00170 // invocations like forwarding, the release becomes essential. 00171 if (ACE_BIT_DISABLED (db->flags (), 00172 ACE_Message_Block::DONT_DELETE)) 00173 db->release (); 00174 00175 // Steal the buffer, that way we don't do any unnecesary copies of 00176 // this data. 00177 CORBA::ULong max = params.svc_ctx_.maximum (); 00178 CORBA::ULong len = params.svc_ctx_.length (); 00179 IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (1); 00180 this->reply_service_info_.replace (max, len, context_list, 1); 00181 00182 if (TAO_debug_level >= 4) 00183 { 00184 ACE_DEBUG ((LM_DEBUG, 00185 ACE_TEXT ("(%P | %t):") 00186 ACE_TEXT ("TAO_DII_Asynch_Reply_Dispatcher::dispatch_reply: status = %d\n"), 00187 this->reply_status_)); 00188 } 00189 00190 try 00191 { 00192 // Call the handler with the reply data. 00193 CORBA::Request::_tao_reply_stub (this->reply_cdr_, 00194 this->callback_, 00195 this->reply_status_); 00196 } 00197 catch (const CORBA::Exception& ex) 00198 { 00199 if (TAO_debug_level >= 4) 00200 { 00201 ex._tao_print_exception ("Exception during reply handler"); 00202 } 00203 } 00204 // This was dynamically allocated. Now the job is done. 00205 (void) this->decr_refcount (); 00206 00207 return 1; 00208 }
char TAO_DII_Asynch_Reply_Dispatcher::buf_[ACE_CDR::DEFAULT_BUFSIZE] [private] |
The buffer that is used to initialise the data block.
Reimplemented from TAO_Asynch_Reply_Dispatcher_Base.
Definition at line 99 of file DII_Reply_Dispatcher.h.
const Messaging::ReplyHandler_ptr TAO_DII_Asynch_Reply_Dispatcher::callback_ [private] |
Where the reply needs to go.
Definition at line 109 of file DII_Reply_Dispatcher.h.
Referenced by ~TAO_DII_Asynch_Reply_Dispatcher().
Datablock that is created on the stack to initialise the CDR stream underneath.
Reimplemented from TAO_Asynch_Reply_Dispatcher_Base.
Definition at line 103 of file DII_Reply_Dispatcher.h.
CDR stream for reading the input.
Reimplemented from TAO_Asynch_Reply_Dispatcher_Base.
Definition at line 106 of file DII_Reply_Dispatcher.h.
Referenced by dispatch_reply().