00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Thread_Lane_Resources.h 00006 * 00007 * $Id: Thread_Lane_Resources.h 76995 2007-02-11 12:51:42Z johnnyw $ 00008 * 00009 * @author Irfan Pyarali 00010 */ 00011 // =================================================================== 00012 00013 #ifndef TAO_THREAD_LANE_RESOURCES_H 00014 #define TAO_THREAD_LANE_RESOURCES_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/orbconf.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "ace/Thread_Mutex.h" 00025 #include /**/ "tao/TAO_Export.h" 00026 #include "tao/params.h" 00027 00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00029 class ACE_Allocator; 00030 ACE_END_VERSIONED_NAMESPACE_DECL 00031 00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00033 00034 class TAO_ORB_Core; 00035 class TAO_Acceptor_Registry; 00036 class TAO_Leader_Follower; 00037 class TAO_MProfile; 00038 class TAO_New_Leader_Generator; 00039 class TAO_Connector_Registry; 00040 class TAO_Resource_Factory; 00041 00042 namespace TAO 00043 { 00044 class Transport_Cache_Manager; 00045 } 00046 00047 /** 00048 * @class TAO_Thread_Lane_Resources 00049 * 00050 * @brief Class representing a thread lane's resources. 00051 * 00052 * \nosubgrouping 00053 * 00054 **/ 00055 class TAO_Export TAO_Thread_Lane_Resources 00056 { 00057 public: 00058 /// Constructor. 00059 TAO_Thread_Lane_Resources ( 00060 TAO_ORB_Core &orb_core, 00061 TAO_New_Leader_Generator *new_leader_generator = 0); 00062 00063 /// Destructor. 00064 ~TAO_Thread_Lane_Resources (void); 00065 00066 // Does @a mprofile belong to us? 00067 int is_collocated (const TAO_MProfile &mprofile); 00068 00069 /// Open the acceptor registry. 00070 int open_acceptor_registry (const TAO_EndpointSet &endpoint_set, 00071 bool ignore_address); 00072 00073 /// Finalize resources. 00074 void finalize (void); 00075 00076 /// Shutdown the reactor. 00077 void shutdown_reactor (void); 00078 00079 /// Certain ORB policies such as dropping replies on shutdown with 00080 /// RW connection handlers would need cleanup of transports to wake 00081 /// threads up. 00082 void cleanup_rw_transports (void); 00083 00084 /// @name Accessors 00085 //@{ 00086 00087 TAO_Acceptor_Registry &acceptor_registry (void); 00088 00089 /* 00090 * @note Returning a pointer helps to return 0 in case of 00091 * exceptions. 00092 */ 00093 TAO_Connector_Registry *connector_registry (void); 00094 00095 TAO::Transport_Cache_Manager &transport_cache (void); 00096 00097 TAO_Leader_Follower &leader_follower (void); 00098 00099 /* Allocator is intended for allocating the ACE_Data_Blocks used in 00100 * incoming CDR streams. This allocator has locks. 00101 */ 00102 ACE_Allocator *input_cdr_dblock_allocator (void); 00103 00104 /* Allocator is intended for allocating the buffers in the incoming 00105 * CDR streams. This allocator has locks. 00106 */ 00107 ACE_Allocator *input_cdr_buffer_allocator (void); 00108 00109 /* Allocator is intended for allocating the ACE_Message_Blocks used 00110 * in incoming CDR streams. This allocator is global, and has locks. 00111 */ 00112 ACE_Allocator *input_cdr_msgblock_allocator (void); 00113 00114 /* Allocator is intended for allocating the buffers used in the 00115 * Transport object. This allocator has locks. 00116 */ 00117 ACE_Allocator *transport_message_buffer_allocator (void); 00118 00119 /* Allocator is intended for allocating the ACE_Data_Blocks used in 00120 * outgoing CDR streams. This allocator has locks. 00121 */ 00122 ACE_Allocator *output_cdr_dblock_allocator (void); 00123 00124 /* Allocator is intended for allocating the buffers in the outgoing 00125 * CDR streams. This allocator has locks. 00126 */ 00127 ACE_Allocator *output_cdr_buffer_allocator (void); 00128 00129 /* Allocator is intended for allocating the ACE_Message_Blocks used 00130 * in the outgoing CDR streams. This allocator is global, and has 00131 * locks. 00132 */ 00133 ACE_Allocator *output_cdr_msgblock_allocator (void); 00134 00135 /* Allocator is intended for allocating the AMH response handlers 00136 * This allocator is global. 00137 */ 00138 ACE_Allocator *amh_response_handler_allocator (void); 00139 00140 /* Allocator is intended for allocating the AMI response handlers 00141 * This allocator is global. 00142 */ 00143 ACE_Allocator *ami_response_handler_allocator (void); 00144 //@} 00145 00146 private: 00147 00148 /// Checks if the acceptor registry has been created. 00149 int has_acceptor_registry_been_created (void) const; 00150 00151 /// Helper to get the resource factory in the ORB_Core 00152 TAO_Resource_Factory *resource_factory (void); 00153 00154 private: 00155 /// ORB_Core related to this thread lane. 00156 TAO_ORB_Core &orb_core_; 00157 00158 /// The registry which maintains a list of acceptor factories for 00159 /// each loaded protocol. 00160 TAO_Acceptor_Registry *acceptor_registry_; 00161 00162 /// The connector registry which all active connectors must register 00163 /// themselves with. 00164 TAO_Connector_Registry *connector_registry_; 00165 00166 /// Transport cache. 00167 TAO::Transport_Cache_Manager *transport_cache_; 00168 00169 /// The leader/followers management class for this lane. 00170 TAO_Leader_Follower *leader_follower_; 00171 00172 /// Synchronization. 00173 TAO_SYNCH_MUTEX lock_; 00174 00175 /// Generator of new leader threads. 00176 TAO_New_Leader_Generator *new_leader_generator_; 00177 00178 /// @name The allocators for the input CDR streams. 00179 //@{ 00180 ACE_Allocator *input_cdr_dblock_allocator_; 00181 ACE_Allocator *input_cdr_buffer_allocator_; 00182 ACE_Allocator *input_cdr_msgblock_allocator_; 00183 //@} 00184 00185 /// @name The allocators for the buffering messages in the transport. 00186 //@{ 00187 ACE_Allocator *transport_message_buffer_allocator_; 00188 //@} 00189 00190 /// @name The allocators for the output CDR streams. 00191 //@{ 00192 ACE_Allocator *output_cdr_dblock_allocator_; 00193 ACE_Allocator *output_cdr_buffer_allocator_; 00194 ACE_Allocator *output_cdr_msgblock_allocator_; 00195 //@} 00196 00197 /// @name The allocators for AMH. 00198 //@{ 00199 ACE_Allocator *amh_response_handler_allocator_; 00200 //@} 00201 00202 /// @name The allocators for AMI. 00203 //@{ 00204 ACE_Allocator *ami_response_handler_allocator_; 00205 //@} 00206 }; 00207 00208 TAO_END_VERSIONED_NAMESPACE_DECL 00209 00210 #include /**/ "ace/post.h" 00211 00212 #endif /* TAO_THREAD_LANE_RESOURCES_H */