#include <ORBInitializer_Registry_Impl.h>
Inheritance diagram for TAO::ORBInitializer_Registry:
Public Member Functions | |
ORBInitializer_Registry (void) | |
virtual int | init (int, ACE_TCHAR *[]) |
virtual int | fini (void) |
virtual void | register_orb_initializer (PortableInterceptor::ORBInitializer_ptr init) |
virtual size_t | pre_init (TAO_ORB_Core *orb_core, int argc, char *argv[], PortableInterceptor::SlotId &slotid) |
virtual void | post_init (size_t pre_init_count, TAO_ORB_Core *orb_core, int argc, char *argv[], PortableInterceptor::SlotId slotid) |
Private Member Functions | |
ORBInitializer_Registry (const ORBInitializer_Registry &) | |
void | operator= (const ORBInitializer_Registry &) |
Private Attributes | |
TAO_SYNCH_RECURSIVE_MUTEX | lock_ |
ACE_Array_Base< PortableInterceptor::ORBInitializer_var > | initializers_ |
Dynamic array containing registered ORBInitializers. |
Definition at line 44 of file ORBInitializer_Registry_Impl.h.
|
Definition at line 24 of file ORBInitializer_Registry_Impl.cpp.
00025 : lock_ (), 00026 initializers_ () 00027 { 00028 } |
|
|
|
Service config fini method, release all ORBInitializers at this moment Reimplemented from ACE_Shared_Object. Definition at line 74 of file ORBInitializer_Registry_Impl.cpp. References ACE_GUARD_RETURN, initializers_, and TAO_SYNCH_RECURSIVE_MUTEX.
00075 { 00076 ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX, 00077 guard, 00078 this->lock_, 00079 -1); 00080 00081 // Release all initializers in the array 00082 size_t const initializer_count (this->initializers_.size ()); 00083 for (size_t i = 0; i < initializer_count; ++i) 00084 { 00085 this->initializers_[i] = PortableInterceptor::ORBInitializer::_nil(); 00086 } 00087 00088 return 0; 00089 } |
|
Added to provide registration for the several static service objects, brought in with this ORBInitializer_Registry implementation. Note that this is more reliable than using static initializers, since multiple copies of the dynamic service object will require their own (multiple) copies of the dependent static service objects. That is just impossible without registering those static services in the same repo, the dynamic SO is registered with. Reimplemented from ACE_Shared_Object. Definition at line 31 of file ORBInitializer_Registry_Impl.cpp. References ACE_NEW_THROW_EX, register_orb_initializer(), and TAO_debug_level.
00032 { 00033 #if !defined (TAO_AS_STATIC_LIBS) && (TAO_HAS_INTERCEPTORS == 1) 00034 ACE_Service_Config::process_directive 00035 (ace_svc_desc_TAO_ClientRequestInterceptor_Adapter_Factory_Impl); 00036 00037 ACE_Service_Config::process_directive 00038 (ace_svc_desc_TAO_PICurrent_Loader); 00039 00040 PortableInterceptor::ORBInitializer_ptr temp_orb_initializer = 00041 PortableInterceptor::ORBInitializer::_nil (); 00042 00043 PortableInterceptor::ORBInitializer_var orb_initializer; 00044 00045 try 00046 { 00047 /// Register the PI ORBInitializer. 00048 00049 ACE_NEW_THROW_EX (temp_orb_initializer, 00050 TAO_PI_ORBInitializer, 00051 CORBA::NO_MEMORY ( 00052 CORBA::SystemException::_tao_minor_code ( 00053 TAO::VMCID, 00054 ENOMEM), 00055 CORBA::COMPLETED_NO)); 00056 00057 orb_initializer = temp_orb_initializer; 00058 00059 this->register_orb_initializer (orb_initializer.in ()); 00060 } 00061 catch (const ::CORBA::Exception& ex) 00062 { 00063 if (TAO_debug_level > 0) 00064 { 00065 ex._tao_print_exception ("(%P|%t) Caught exception:"); 00066 } 00067 return -1; 00068 } 00069 #endif /* !TAO_AS_STATIC_LIBS && TAO_HAS_INTERCEPTORS == 1 */ 00070 return 0; 00071 } |
|
|
|
Complete initialization of all registered ORBInitializers after the ORB has been initialized. Implements TAO::ORBInitializer_Registry_Adapter. Definition at line 167 of file ORBInitializer_Registry_Impl.cpp. References ACE_GUARD, ACE_NEW_THROW_EX, TAO_Objref_Var_T< T >::in(), TAO::PICurrent::initialize(), initializers_, CORBA::is_nil(), TAO_ORBInitInfo_var, and TAO_SYNCH_RECURSIVE_MUTEX.
00173 { 00174 if (pre_init_count > 0) 00175 { 00176 ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, 00177 guard, 00178 this->lock_); 00179 00180 TAO_ORBInitInfo * orb_init_info_temp = 0; 00181 00182 ACE_NEW_THROW_EX (orb_init_info_temp, 00183 TAO_ORBInitInfo (orb_core, 00184 argc, 00185 argv, 00186 slotid), 00187 CORBA::NO_MEMORY ( 00188 CORBA::SystemException::_tao_minor_code ( 00189 0, 00190 ENOMEM), 00191 CORBA::COMPLETED_NO)); 00192 00193 TAO_ORBInitInfo_var orb_init_info_ = orb_init_info_temp; 00194 00195 for (size_t i = 0; i < pre_init_count; ++i) 00196 { 00197 this->initializers_[i]->post_init (orb_init_info_.in ()); 00198 } 00199 00200 #if TAO_HAS_INTERCEPTORS == 1 00201 CORBA::Object_ptr picurrent_ptr = orb_core->pi_current (); 00202 PortableInterceptor::SlotId slot_count = orb_init_info_->slot_count (); 00203 00204 if (CORBA::is_nil (picurrent_ptr) && slot_count != 0) 00205 { 00206 // Force instantiation of the PICurrent object. If we do not do it 00207 // now, the slot count will be lost. 00208 CORBA::Object_var tmp = orb_core->resolve_picurrent (); 00209 picurrent_ptr = orb_core->pi_current (); 00210 } 00211 00212 if (!CORBA::is_nil (picurrent_ptr)) 00213 { 00214 TAO::PICurrent *pi = dynamic_cast <TAO::PICurrent*> (picurrent_ptr); 00215 00216 if (pi) 00217 { 00218 pi->initialize (slot_count); 00219 } 00220 } 00221 #endif /* TAO_HAS_INTERCEPTORS == 1 */ 00222 00223 // Invalidate the ORBInitInfo instance to prevent future 00224 // modifications to the ORB. This behavior complies with the 00225 // PortableInterceptor specification. 00226 orb_init_info_temp->invalidate (); 00227 } 00228 } |
|
Begin initialization of all registered ORBInitializers before the ORB itself is initialized. Implements TAO::ORBInitializer_Registry_Adapter. Definition at line 120 of file ORBInitializer_Registry_Impl.cpp. References ACE_GUARD_RETURN, ACE_NEW_THROW_EX, TAO_Objref_Var_T< T >::in(), initializers_, TAO_ORBInitInfo_var, and TAO_SYNCH_RECURSIVE_MUTEX.
00125 { 00126 ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX, 00127 guard, 00128 this->lock_, 00129 0); 00130 00131 size_t const initializer_count (this->initializers_.size ()); 00132 00133 if (initializer_count > 0) 00134 { 00135 TAO_ORBInitInfo * orb_init_info_temp = 0; 00136 00137 ACE_NEW_THROW_EX (orb_init_info_temp, 00138 TAO_ORBInitInfo (orb_core, 00139 argc, 00140 argv, 00141 slotid), 00142 CORBA::NO_MEMORY ( 00143 CORBA::SystemException::_tao_minor_code ( 00144 0, 00145 ENOMEM), 00146 CORBA::COMPLETED_NO)); 00147 00148 TAO_ORBInitInfo_var orb_init_info_ = orb_init_info_temp; 00149 00150 for (size_t i = 0; i < initializer_count; ++i) 00151 { 00152 this->initializers_[i]->pre_init (orb_init_info_.in ()); 00153 } 00154 00155 slotid = orb_init_info_temp->slot_count (); 00156 00157 // Invalidate the ORBInitInfo instance to prevent future 00158 // modifications to the ORB. This behavior complies with the 00159 // PortableInterceptor specification. 00160 orb_init_info_temp->invalidate (); 00161 } 00162 00163 return initializer_count; 00164 } |
|
Register an ORBInitializer with the underlying ORBInitializer array. Implements TAO::ORBInitializer_Registry_Adapter. Definition at line 92 of file ORBInitializer_Registry_Impl.cpp. References ACE_GUARD, initializers_, CORBA::is_nil(), and TAO_SYNCH_RECURSIVE_MUTEX. Referenced by init().
00094 { 00095 if (!CORBA::is_nil (init)) 00096 { 00097 ACE_GUARD (TAO_SYNCH_RECURSIVE_MUTEX, 00098 guard, 00099 this->lock_); 00100 00101 // Increase the length of the ORBInitializer array by one. 00102 size_t const cur_len = this->initializers_.size (); 00103 size_t const new_len = cur_len + 1; 00104 if (this->initializers_.size (new_len) != 0) 00105 throw ::CORBA::INTERNAL (); 00106 00107 // Add the given ORBInitializer to the sequence. 00108 this->initializers_[cur_len] = 00109 PortableInterceptor::ORBInitializer::_duplicate (init); 00110 } 00111 else 00112 throw ::CORBA::INV_OBJREF ( 00113 CORBA::SystemException::_tao_minor_code ( 00114 0, 00115 EINVAL), 00116 CORBA::COMPLETED_NO); 00117 } |
|
Dynamic array containing registered ORBInitializers.
Definition at line 93 of file ORBInitializer_Registry_Impl.h. Referenced by fini(), post_init(), pre_init(), and register_orb_initializer(). |
|
Definition at line 90 of file ORBInitializer_Registry_Impl.h. |