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