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