Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

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 Methods

 TAO_Exclusive_TMS (TAO_Transport *transport)
 Constructor. More...

virtual ~TAO_Exclusive_TMS (void)
 Destructor. More...

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)
 Generate and return an unique request id for the current invocation. More...

virtual int bind_dispatcher (CORBA::ULong request_id, TAO_Reply_Dispatcher *rh)
 Bind the dispatcher with the request id. Commonalities in the derived class implementations is kept here. More...

virtual int unbind_dispatcher (CORBA::ULong request_id)
virtual int dispatch_reply (TAO_Pluggable_Reply_Params &params)
 Dispatch the reply for <request_id>, cleanup any resources allocated for that request. More...

virtual int idle_after_send (void)
 Request has been just sent, but the reply is not received. Idle the transport now. More...

virtual int idle_after_reply (void)
 Request is sent and the reply is received. Idle the transport now. More...

virtual void connection_closed (void)
 The transport object has closed the connection, inform all Reply dispatchers and waiting strategies. More...


Protected Attributes

CORBA::ULong request_id_generator_
 Used to generate a different request_id on each call to request_id(). More...

int has_request_
 If 0 then the request id and reply dispatcher below are meaningless. More...

CORBA::ULong request_id_
 Request id for the current request. More...

TAO_Reply_Dispatcherrd_
 Reply Dispatcher corresponding to the request. More...


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 37 of file Exclusive_TMS.h.


Constructor & Destructor Documentation

TAO_Exclusive_TMS::TAO_Exclusive_TMS TAO_Transport   transport
 

Constructor.

Definition at line 12 of file Exclusive_TMS.cpp.

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

TAO_Exclusive_TMS::~TAO_Exclusive_TMS void    [virtual]
 

Destructor.

Definition at line 21 of file Exclusive_TMS.cpp.

00022 {
00023 }


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 56 of file Exclusive_TMS.cpp.

References has_request_, rd_, request_id, and request_id_.

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

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 120 of file Exclusive_TMS.cpp.

References TAO_Reply_Dispatcher::connection_closed, and rd_.

00121 {
00122   if (this->rd_ != 0)
00123     this->rd_->connection_closed ();
00124 }

int TAO_Exclusive_TMS::dispatch_reply TAO_Pluggable_Reply_Params   params [virtual]
 

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

Implements TAO_Transport_Mux_Strategy.

Definition at line 79 of file Exclusive_TMS.cpp.

References ACE_DEBUG, ACE_TEXT, TAO_Reply_Dispatcher::dispatch_reply, has_request_, LM_DEBUG, rd_, TAO_Pluggable_Reply_Params_Base::request_id_, and request_id_.

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

int TAO_Exclusive_TMS::idle_after_reply void    [virtual]
 

Request is sent and the reply is received. Idle the transport now.

Implements TAO_Transport_Mux_Strategy.

Definition at line 111 of file Exclusive_TMS.cpp.

References TAO_Transport::make_idle, and TAO_Transport_Mux_Strategy::transport_.

00112 {
00113   if (this->transport_ != 0)
00114     return this->transport_->make_idle ();
00115 
00116   return 0;
00117 }

int TAO_Exclusive_TMS::idle_after_send void    [virtual]
 

Request has been just sent, but the reply is not received. Idle the transport now.

Implements TAO_Transport_Mux_Strategy.

Definition at line 105 of file Exclusive_TMS.cpp.

00106 {
00107   return 0;
00108 }

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 29 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_Transport_Mux_Strategy::transport_.

Referenced by bind_dispatcher, and unbind_dispatcher.

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

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 67 of file Exclusive_TMS.cpp.

References has_request_, rd_, request_id, and request_id_.

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


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 73 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 79 of file Exclusive_TMS.h.

Referenced by bind_dispatcher, connection_closed, dispatch_reply, and unbind_dispatcher.

CORBA::ULong TAO_Exclusive_TMS::request_id_ [protected]
 

Request id for the current request.

Definition at line 76 of file Exclusive_TMS.h.

Referenced by bind_dispatcher, dispatch_reply, and unbind_dispatcher.

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 69 of file Exclusive_TMS.h.

Referenced by request_id.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:15:00 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002