#include <Exclusive_TMS.h>
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, ACE_Intrusive_Auto_Ptr< TAO_Reply_Dispatcher > rd) |
virtual int | unbind_dispatcher (CORBA::ULong request_id) |
virtual int | dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) |
virtual int | reply_timed_out (CORBA::ULong request_id) |
virtual bool | idle_after_send (void) |
virtual bool | idle_after_reply (void) |
virtual void | connection_closed (void) |
virtual bool | has_request (void) |
Do we have a request pending. | |
Protected Attributes | |
CORBA::ULong | request_id_generator_ |
CORBA::ULong | request_id_ |
Request id for the current request. | |
ACE_Intrusive_Auto_Ptr < TAO_Reply_Dispatcher > | rd_ |
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 40 of file Exclusive_TMS.h.
TAO_Exclusive_TMS::TAO_Exclusive_TMS | ( | TAO_Transport * | transport | ) |
Constructor.
Definition at line 14 of file Exclusive_TMS.cpp.
: TAO_Transport_Mux_Strategy (transport), request_id_generator_ (0), request_id_ (0), rd_ (0) { }
TAO_Exclusive_TMS::~TAO_Exclusive_TMS | ( | void | ) | [virtual] |
int TAO_Exclusive_TMS::bind_dispatcher | ( | CORBA::ULong | request_id, | |
ACE_Intrusive_Auto_Ptr< TAO_Reply_Dispatcher > | rd | |||
) | [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 57 of file Exclusive_TMS.cpp.
{ this->request_id_ = request_id; this->rd_ = rd.get (); return 0; }
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 152 of file Exclusive_TMS.cpp.
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 84 of file Exclusive_TMS.cpp.
{ // Check the ids. if (!this->rd_ || this->request_id_ != params.request_id_) { if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Exclusive_TMS::dispatch_reply - <%d != %d>\n"), this->request_id_, params.request_id_)); // The return value 0 informs the transport that the mux strategy // did not find the right reply handler. return 0; } ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd (this->rd_.get ()); this->request_id_ = 0; // @@ What is a good value??? this->rd_.release (); // Dispatch the reply. // Returns 1 on success, -1 on failure. return rd->dispatch_reply (params); }
bool TAO_Exclusive_TMS::has_request | ( | void | ) | [virtual] |
Do we have a request pending.
Implements TAO_Transport_Mux_Strategy.
Definition at line 67 of file Exclusive_TMS.cpp.
{ return this->rd_ != 0; }
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 140 of file Exclusive_TMS.cpp.
{ // Irrespective of whether we are successful or not we need to // return true. If *this* class is not successfull in idling the // transport no one can. if (this->transport_ != 0) (void) this->transport_->make_idle (); return true; }
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 134 of file Exclusive_TMS.cpp.
{ return false; }
int TAO_Exclusive_TMS::reply_timed_out | ( | CORBA::ULong | request_id | ) | [virtual] |
Dispatch a reply timeout for request request_id
Implements TAO_Transport_Mux_Strategy.
Definition at line 109 of file Exclusive_TMS.cpp.
{ // Check the ids. if (!this->rd_ || this->request_id_ != request_id) { if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Exclusive_TMS::reply_timed_out - <%d != %d>\n"), this->request_id_, request_id)); // The return value 0 informs the transport that the mux strategy // did not find the right reply handler. return 0; } ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd (this->rd_.get ()); this->request_id_ = 0; // @@ What is a good value??? this->rd_.release (); rd->reply_timed_out (); return 0; }
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 30 of file Exclusive_TMS.cpp.
{ ++this->request_id_generator_; // if TAO_Transport::bidirectional_flag_ // == 1 --> originating side // == 0 --> other side // == -1 --> no bi-directional connection was negotiated // The originating side must have an even request ID, and the other // side must have an odd request ID. Make sure that is the case. int const bidir_flag = this->transport_->bidirectional_flag (); if ((bidir_flag == 1 && ACE_ODD (this->request_id_generator_)) || (bidir_flag == 0 && ACE_EVEN (this->request_id_generator_))) ++this->request_id_generator_; if (TAO_debug_level > 4) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Exclusive_TMS::request_id - <%d>\n"), this->request_id_generator_)); return this->request_id_generator_; }
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 73 of file Exclusive_TMS.cpp.
{ if (!this->rd_ || this->request_id_ != request_id) return -1; this->rd_.release (); return 0; }
Reply Dispatcher corresponding to the request. If this is zero we don't have a reply, if it not zero we have one
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 77 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 74 of file Exclusive_TMS.h.