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