TAO_DII_Deferred_Reply_Dispatcher Class Reference

Reply dispatcher for DII deferred requests. More...

#include <DII_Reply_Dispatcher.h>

Inheritance diagram for TAO_DII_Deferred_Reply_Dispatcher:

Inheritance graph
[legend]
Collaboration diagram for TAO_DII_Deferred_Reply_Dispatcher:

Collaboration graph
[legend]
List of all members.

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 &param)
 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.


Detailed Description

Reply dispatcher for DII deferred requests.

Definition at line 47 of file DII_Reply_Dispatcher.h.


Constructor & Destructor Documentation

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]
 

Destructor.

Definition at line 27 of file DII_Reply_Dispatcher.cpp.

00028 {
00029 }


Member Function Documentation

void TAO_DII_Deferred_Reply_Dispatcher::connection_closed void   )  [virtual]
 

Implements TAO_Asynch_Reply_Dispatcher_Base.

Definition at line 98 of file DII_Reply_Dispatcher.cpp.

References TAO_Asynch_Reply_Dispatcher_Base::decr_refcount(), req_, TAO_debug_level, and TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION.

00099 {
00100 
00101   try
00102     {
00103       // Generate a fake exception....
00104       CORBA::COMM_FAILURE comm_failure (0, CORBA::COMPLETED_MAYBE);
00105 
00106       TAO_OutputCDR out_cdr;
00107 
00108       comm_failure._tao_encode (out_cdr);
00109 
00110       // Turn into an output CDR
00111       TAO_InputCDR cdr (out_cdr);
00112 
00113       this->req_->handle_response (cdr, TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION);
00114     }
00115   catch (const ::CORBA::Exception& ex)
00116     {
00117       if (TAO_debug_level >= 4)
00118         {
00119           ex._tao_print_exception (
00120             "DII_Deferred_Reply_Dispacher::connection_closed");
00121         }
00122     }
00123 
00124   (void) this->decr_refcount ();
00125 }

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(), TAO_Asynch_Reply_Dispatcher_Base::decr_refcount(), ACE_Data_Block::flags(), TAO_Pluggable_Reply_Params::input_cdr_, LM_DEBUG, LM_ERROR, ACE_Data_Block::release(), TAO_Pluggable_Reply_Params_Base::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 
00041   // Transfer the <params.input_cdr_>'s content to this->reply_cdr_
00042   ACE_Data_Block *db = this->reply_cdr_.clone_from (*params.input_cdr_);
00043 
00044   if (db == 0)
00045     {
00046       if (TAO_debug_level > 2)
00047         {
00048           ACE_ERROR ((
00049             LM_ERROR,
00050             "TAO (%P|%t) - DII_Deferred_Reply_Dispatcher::dispatch_reply "
00051             "clone_from failed \n"));
00052         }
00053       return -1;
00054     }
00055 
00056   // See whether we need to delete the data block by checking the
00057   // flags. We cannot be happy that we initally allocated the
00058   // datablocks of the stack. If this method is called twice, as is in
00059   // some cases where the same invocation object is used to make two
00060   // invocations like forwarding, the release becomes essential.
00061   if (ACE_BIT_DISABLED (db->flags (),
00062                         ACE_Message_Block::DONT_DELETE))
00063     db->release ();
00064 
00065   // Steal the buffer, that way we don't do any unnecesary copies of
00066   // this data.
00067   CORBA::ULong max = params.svc_ctx_.maximum ();
00068   CORBA::ULong len = params.svc_ctx_.length ();
00069   IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (1);
00070   this->reply_service_info_.replace (max, len, context_list, 1);
00071 
00072   if (TAO_debug_level >= 4)
00073     {
00074       ACE_DEBUG ((LM_DEBUG,
00075                   ACE_TEXT ("(%P | %t):TAO_Asynch_Reply_Dispatcher::dispatch_reply:\n")));
00076     }
00077 
00078   try
00079     {
00080       // Call the Request back and send the reply data.
00081       this->req_->handle_response (this->reply_cdr_, this->reply_status_);
00082     }
00083   catch (const ::CORBA::Exception& ex)
00084     {
00085       if (TAO_debug_level >= 4)
00086         {
00087           ex._tao_print_exception ("Exception during reply handler");
00088         }
00089     }
00090 
00091   // This was dynamically allocated. Now the job is done.
00092   (void) this->decr_refcount ();
00093 
00094   return 1;
00095 }

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.

00062 {}

virtual long TAO_DII_Deferred_Reply_Dispatcher::schedule_timer CORBA::ULong  ,
const ACE_Time_Value
[inline, virtual]
 

Implements TAO_Asynch_Reply_Dispatcher_Base.

Definition at line 63 of file DII_Reply_Dispatcher.h.

00064   {
00065     return 0;
00066   }


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:37:47 2008 for TAO_DynamicInterface by doxygen 1.3.6