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)
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 44 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 19 of file DII_Reply_Dispatcher.cpp.

00022   : TAO_Asynch_Reply_Dispatcher_Base (orb_core)
00023   , req_ (req)
00024 {
00025 }

TAO_DII_Deferred_Reply_Dispatcher::~TAO_DII_Deferred_Reply_Dispatcher void   )  [protected]
 

Destructor.

Definition at line 28 of file DII_Reply_Dispatcher.cpp.

00029 {
00030 }


Member Function Documentation

void TAO_DII_Deferred_Reply_Dispatcher::connection_closed void   )  [virtual]
 

Implements TAO_Asynch_Reply_Dispatcher_Base.

Definition at line 107 of file DII_Reply_Dispatcher.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_CHECK, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, TAO_Asynch_Reply_Dispatcher_Base::decr_refcount(), req_, TAO_debug_level, and TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION.

00108 {
00109   ACE_DECLARE_NEW_CORBA_ENV;
00110 
00111   ACE_TRY
00112     {
00113       // Generate a fake exception....
00114       CORBA::COMM_FAILURE comm_failure (0,
00115                                         CORBA::COMPLETED_MAYBE);
00116 
00117       TAO_OutputCDR out_cdr;
00118 
00119       comm_failure._tao_encode (out_cdr
00120                                 ACE_ENV_ARG_PARAMETER);
00121       ACE_TRY_CHECK;
00122 
00123       // Turn into an output CDR
00124       TAO_InputCDR cdr (out_cdr);
00125 
00126       this->req_->handle_response (cdr,
00127                                    TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION
00128                                    ACE_ENV_ARG_PARAMETER);
00129       ACE_TRY_CHECK;
00130     }
00131   ACE_CATCHANY
00132     {
00133       if (TAO_debug_level >= 4)
00134         {
00135           ACE_PRINT_EXCEPTION (
00136               ACE_ANY_EXCEPTION,
00137               "DII_Deferred_Reply_Dispacher::connection_closed"
00138             );
00139         }
00140     }
00141   ACE_ENDTRY;
00142   ACE_CHECK;
00143 
00144   (void) this->decr_refcount ();
00145 }

int TAO_DII_Deferred_Reply_Dispatcher::dispatch_reply TAO_Pluggable_Reply_Params param  )  [virtual]
 

Implements TAO_Asynch_Reply_Dispatcher_Base.

Definition at line 34 of file DII_Reply_Dispatcher.cpp.

References ACE_ANY_EXCEPTION, ACE_BIT_DISABLED, ACE_CATCHANY, ACE_DEBUG, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ERROR, ACE_PRINT_EXCEPTION, ACE_TEXT, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, ACE_InputCDR::clone_from(), TAO_Asynch_Reply_Dispatcher_Base::decr_refcount(), ACE_Data_Block::flags(), TAO::unbounded_value_sequence< ServiceContext >::get_buffer(), TAO_Pluggable_Reply_Params::input_cdr_, TAO::unbounded_value_sequence< ServiceContext >::length(), LM_DEBUG, LM_ERROR, TAO::unbounded_value_sequence< ServiceContext >::maximum(), ACE_Data_Block::release(), TAO::unbounded_value_sequence< ServiceContext >::replace(), TAO_Pluggable_Reply_Params_Base::reply_status_, req_, TAO_Pluggable_Reply_Params_Base::svc_ctx_, and TAO_debug_level.

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

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 59 of file DII_Reply_Dispatcher.h.

00059 {}

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 60 of file DII_Reply_Dispatcher.h.

00063   {
00064     return 0;
00065   }


Member Data Documentation

const CORBA::Request_ptr TAO_DII_Deferred_Reply_Dispatcher::req_ [private]
 

Where the reply needs to go.

Definition at line 73 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 Thu Nov 9 13:05:03 2006 for TAO_DynamicInterface by doxygen 1.3.6