TAO_Exclusive_TMS Class Reference

#include <Exclusive_TMS.h>

Inheritance diagram for TAO_Exclusive_TMS:

Inheritance graph
[legend]
Collaboration diagram for TAO_Exclusive_TMS:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Exclusive_TMS (TAO_Transport *transport)
 Constructor.

virtual ~TAO_Exclusive_TMS (void)
 Destructor.

The TAO_Transport_Mux_Strategy overrided methods
Please read the documentation in the TAO_Transport_Mux_Strategy class for details.

virtual CORBA::ULong request_id (void)
virtual int bind_dispatcher (CORBA::ULong request_id, TAO_Reply_Dispatcher *rh)
virtual int unbind_dispatcher (CORBA::ULong request_id)
virtual int dispatch_reply (TAO_Pluggable_Reply_Params &params)
virtual bool idle_after_send (void)
virtual bool idle_after_reply (void)
virtual void connection_closed (void)

Protected Attributes

CORBA::ULong request_id_generator_
int has_request_
CORBA::ULong request_id_
 Request id for the current request.

TAO_Reply_Dispatcherrd_
 Reply Dispatcher corresponding to the request.


Detailed Description

Using this strategy only one request can be pending at a time in a connection. This improves performance because the client does not have to demux the reply, and there is less need for synchronization. On the other hand, it does not scale well when you have multiple client threads or asynchronous messaging.

Definition at line 39 of file Exclusive_TMS.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Exclusive_TMS::TAO_Exclusive_TMS TAO_Transport transport  ) 
 

Constructor.

Definition at line 14 of file Exclusive_TMS.cpp.

00015   : TAO_Transport_Mux_Strategy (transport),
00016     request_id_generator_ (0),
00017     has_request_ (0),
00018     request_id_ (0),
00019     rd_ (0)
00020 {
00021 }

TAO_Exclusive_TMS::~TAO_Exclusive_TMS void   )  [virtual]
 

Destructor.

Definition at line 23 of file Exclusive_TMS.cpp.

00024 {
00025 }


Member Function Documentation

int TAO_Exclusive_TMS::bind_dispatcher CORBA::ULong  request_id,
TAO_Reply_Dispatcher rh
[virtual]
 

Bind the dispatcher with the request id. Commonalities in the derived class implementations is kept here.

Implements TAO_Transport_Mux_Strategy.

Definition at line 58 of file Exclusive_TMS.cpp.

References has_request_.

00060 {
00061   this->has_request_ = 1;
00062   this->request_id_ = request_id;
00063   this->rd_ = rd;
00064 
00065   return 0;
00066 }

void TAO_Exclusive_TMS::connection_closed void   )  [virtual]
 

The transport object has closed the connection, inform all Reply dispatchers and waiting strategies.

Implements TAO_Transport_Mux_Strategy.

Definition at line 125 of file Exclusive_TMS.cpp.

References TAO_Reply_Dispatcher::connection_closed().

00126 {
00127   if (this->rd_ != 0)
00128     this->rd_->connection_closed ();
00129 }

int TAO_Exclusive_TMS::dispatch_reply TAO_Pluggable_Reply_Params params  )  [virtual]
 

Dispatch the reply for , cleanup any resources allocated for that request.

Implements TAO_Transport_Mux_Strategy.

Definition at line 81 of file Exclusive_TMS.cpp.

References ACE_DEBUG, ACE_TEXT, TAO_Reply_Dispatcher::dispatch_reply(), has_request_, LM_DEBUG, TAO_Pluggable_Reply_Params_Base::request_id_, and TAO_debug_level.

00082 {
00083   // Check the ids.
00084   if (!this->has_request_ || this->request_id_ != params.request_id_)
00085     {
00086       if (TAO_debug_level > 0)
00087         ACE_DEBUG ((LM_DEBUG,
00088                     ACE_TEXT ("(%P|%t) TAO_Exclusive_TMS::dispatch_reply - <%d != %d>\n"),
00089                     this->request_id_, params.request_id_));
00090 
00091       // The return value 0 informs the transport that the mux strategy
00092       // did not find the right reply handler.
00093       return 0;
00094     }
00095 
00096   TAO_Reply_Dispatcher *rd = this->rd_;
00097   this->has_request_ = 0;
00098   this->request_id_ = 0; // @@ What is a good value???
00099   this->rd_ = 0;
00100 
00101   // Dispatch the reply.
00102   // Returns 1 on success, -1 on failure.
00103   return rd->dispatch_reply (params);
00104 }

bool TAO_Exclusive_TMS::idle_after_reply void   )  [virtual]
 

Request is sent and the reply is received. Idle the transport now. The return value indicates whether idling was successful or not.

Implements TAO_Transport_Mux_Strategy.

Definition at line 113 of file Exclusive_TMS.cpp.

References TAO_Transport::make_idle().

00114 {
00115   // Irrespective of whether we are successful or not we need to
00116   // return true. If *this* class is not successfull in idling the
00117   // transport no one can.
00118   if (this->transport_ != 0)
00119     (void) this->transport_->make_idle ();
00120 
00121   return true;
00122 }

bool TAO_Exclusive_TMS::idle_after_send void   )  [virtual]
 

Request has been just sent, but the reply is not received. Idle the transport now. The return value indicates whether idling was successful or not.

Implements TAO_Transport_Mux_Strategy.

Definition at line 107 of file Exclusive_TMS.cpp.

00108 {
00109   return false;
00110 }

CORBA::ULong TAO_Exclusive_TMS::request_id void   )  [virtual]
 

Generate and return an unique request id for the current invocation.

Implements TAO_Transport_Mux_Strategy.

Definition at line 31 of file Exclusive_TMS.cpp.

References ACE_DEBUG, ACE_EVEN, ACE_ODD, ACE_TEXT, TAO_Transport::bidirectional_flag(), LM_DEBUG, request_id_generator_, and TAO_debug_level.

00032 {
00033   ++this->request_id_generator_;
00034 
00035   // if TAO_Transport::bidirectional_flag_
00036   //  ==  1 --> originating side
00037   //  ==  0 --> other side
00038   //  == -1 --> no bi-directional connection was negotiated
00039   // The originating side must have an even request ID, and the other
00040   // side must have an odd request ID.  Make sure that is the case.
00041   int bidir_flag =
00042     this->transport_->bidirectional_flag ();
00043 
00044   if ((bidir_flag == 1 && ACE_ODD (this->request_id_generator_))
00045        || (bidir_flag == 0 && ACE_EVEN (this->request_id_generator_)))
00046     ++this->request_id_generator_;
00047 
00048   if (TAO_debug_level > 4)
00049     ACE_DEBUG ((LM_DEBUG,
00050                 ACE_TEXT ("TAO (%P|%t) - Exclusive_TMS::request_id - <%d>\n"),
00051                 this->request_id_generator_));
00052 
00053   return this->request_id_generator_;
00054 }

int TAO_Exclusive_TMS::unbind_dispatcher CORBA::ULong  request_id  )  [virtual]
 

Unbind the dispatcher, the client is no longer waiting for the request, for example, because the request timedout. The strategy can (must) cleanup any resources associated with the request. A later reply for that request should be ignored.

Implements TAO_Transport_Mux_Strategy.

Definition at line 69 of file Exclusive_TMS.cpp.

References has_request_.

00070 {
00071   if (!this->has_request_ || this->request_id_ != request_id)
00072     return -1;
00073   this->has_request_ = 0;
00074   this->request_id_ = 0;
00075   this->rd_ = 0;
00076 
00077   return 0;
00078 }


Member Data Documentation

int TAO_Exclusive_TMS::has_request_ [protected]
 

If 0 then the request id and reply dispatcher below are meaningless

Definition at line 75 of file Exclusive_TMS.h.

Referenced by bind_dispatcher(), dispatch_reply(), and unbind_dispatcher().

TAO_Reply_Dispatcher* TAO_Exclusive_TMS::rd_ [protected]
 

Reply Dispatcher corresponding to the request.

Definition at line 81 of file Exclusive_TMS.h.

CORBA::ULong TAO_Exclusive_TMS::request_id_ [protected]
 

Request id for the current request.

Definition at line 78 of file Exclusive_TMS.h.

CORBA::ULong TAO_Exclusive_TMS::request_id_generator_ [protected]
 

Used to generate a different request_id on each call to request_id().

Definition at line 71 of file Exclusive_TMS.h.

Referenced by request_id().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:13:47 2006 for TAO by doxygen 1.3.6