00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Muxed_TMS.h 00006 * 00007 * $Id: Muxed_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_MUXED_TMS_H 00015 #define TAO_MUXED_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 #include "ace/Hash_Map_Manager_T.h" 00026 #include "ace/Null_Mutex.h" 00027 00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00029 template <class X> class ACE_Intrusive_Auto_Ptr; 00030 ACE_END_VERSIONED_NAMESPACE_DECL 00031 00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00033 00034 class TAO_ORB_Core; 00035 class TAO_Pluggable_Reply_Params; 00036 class TAO_Reply_Dispatcher; 00037 00038 /** 00039 * @class TAO_Muxed_TMS 00040 * 00041 * Using this strategy a single connection can have multiple 00042 * outstanding requests. 00043 * @@ Can the performance of the demuxer be made more predictable, 00044 * for example, using the request id as an active demux key? 00045 * @note Check the OMG resolutions about bidirectional 00046 * connections, it is possible that the request ids can only 00047 * assume even or odd values. 00048 */ 00049 class TAO_Export TAO_Muxed_TMS : public TAO_Transport_Mux_Strategy 00050 { 00051 00052 public: 00053 /// Constructor. 00054 TAO_Muxed_TMS (TAO_Transport *transport); 00055 00056 /// Destructor. 00057 virtual ~TAO_Muxed_TMS (void); 00058 00059 /// Generate and return an unique request id for the current 00060 /// invocation. 00061 virtual CORBA::ULong request_id (void); 00062 00063 // = Please read the documentation in the TAO_Transport_Mux_Strategy 00064 // class. 00065 virtual int bind_dispatcher (CORBA::ULong request_id, 00066 ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd); 00067 virtual int unbind_dispatcher (CORBA::ULong request_id); 00068 00069 virtual int dispatch_reply (TAO_Pluggable_Reply_Params ¶ms); 00070 virtual int reply_timed_out (CORBA::ULong request_id); 00071 00072 virtual bool idle_after_send (void); 00073 virtual bool idle_after_reply (void); 00074 virtual void connection_closed (void); 00075 virtual bool has_request (void); 00076 00077 private: 00078 void operator= (const TAO_Muxed_TMS &); 00079 TAO_Muxed_TMS (const TAO_Muxed_TMS &); 00080 00081 private: 00082 /// Lock to protect the state of the object 00083 ACE_Lock *lock_; 00084 00085 /// Used to generate a different request_id on each call to 00086 /// request_id(). 00087 CORBA::ULong request_id_generator_; 00088 00089 /// Keep track of the orb core pointer. We need to this to create the 00090 /// Reply Dispatchers. 00091 TAO_ORB_Core * const orb_core_; 00092 00093 typedef ACE_Hash_Map_Manager_Ex <CORBA::ULong, 00094 ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher>, 00095 ACE_Hash <CORBA::ULong>, 00096 ACE_Equal_To <CORBA::ULong>, 00097 ACE_Null_Mutex> 00098 REQUEST_DISPATCHER_TABLE; 00099 00100 /// Table of <Request ID, Reply Dispatcher> pairs. 00101 REQUEST_DISPATCHER_TABLE dispatcher_table_; 00102 00103 int clear_cache_i (void); 00104 }; 00105 00106 TAO_END_VERSIONED_NAMESPACE_DECL 00107 00108 #include /**/ "ace/post.h" 00109 00110 #endif /* MUXED_TMS_H */