00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Exclusive_TMS.h 00006 * 00007 * $Id: Exclusive_TMS.h 85012 2009-04-02 10:05:46Z msmit $ 00008 * 00009 * @author Alexander Babu Arulanthu <alex@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef TAO_EXCLUSIVE_TMS_H 00015 #define TAO_EXCLUSIVE_TMS_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "tao/Transport_Mux_Strategy.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00026 00027 class TAO_Pluggable_Reply_Params; 00028 class TAO_Reply_Dispatcher; 00029 00030 /** 00031 * @class TAO_Exclusive_TMS 00032 * 00033 * Using this strategy only one request can be pending at a time 00034 * in a connection. This improves performance because the client 00035 * does not have to demux the reply, and there is less need for 00036 * synchronization. 00037 * On the other hand, it does not scale well when you have 00038 * multiple client threads or asynchronous messaging. 00039 */ 00040 class TAO_Export TAO_Exclusive_TMS : public TAO_Transport_Mux_Strategy 00041 { 00042 00043 public: 00044 /// Constructor. 00045 TAO_Exclusive_TMS (TAO_Transport *transport); 00046 00047 /// Destructor. 00048 virtual ~TAO_Exclusive_TMS (void); 00049 00050 /** 00051 * @name The TAO_Transport_Mux_Strategy overrided methods 00052 * 00053 * Please read the documentation in the TAO_Transport_Mux_Strategy class 00054 * for details. 00055 */ 00056 //@{ 00057 virtual CORBA::ULong request_id (void); 00058 virtual int bind_dispatcher (CORBA::ULong request_id, 00059 ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd); 00060 virtual int unbind_dispatcher (CORBA::ULong request_id); 00061 00062 virtual int dispatch_reply (TAO_Pluggable_Reply_Params ¶ms); 00063 virtual int reply_timed_out (CORBA::ULong request_id); 00064 00065 virtual bool idle_after_send (void); 00066 virtual bool idle_after_reply (void); 00067 virtual void connection_closed (void); 00068 virtual bool has_request (void); 00069 //@} 00070 00071 protected: 00072 /// Used to generate a different request_id on each call to 00073 /// request_id(). 00074 CORBA::ULong request_id_generator_; 00075 00076 /// Request id for the current request. 00077 CORBA::ULong request_id_; 00078 00079 /// Reply Dispatcher corresponding to the request. If this is zero we don't 00080 /// have a reply, if it not zero we have one 00081 ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd_; 00082 }; 00083 00084 TAO_END_VERSIONED_NAMESPACE_DECL 00085 00086 #include /**/ "ace/post.h" 00087 #endif /* EXCLUSIVE_TMS_H */