#include <CosNotify_Service.h>
Inheritance diagram for TAO_CosNotify_Service:
Public Member Functions | |
TAO_CosNotify_Service (void) | |
Constuctor. | |
virtual | ~TAO_CosNotify_Service () |
Destructor. | |
virtual int | init (int argc, ACE_TCHAR *argv[]) |
Init the service from configurator. | |
virtual void | init_service (CORBA::ORB_ptr orb) |
Init the service from driver. | |
virtual int | fini (void) |
virtual CosNotifyChannelAdmin::EventChannelFactory_ptr | create (PortableServer::POA_ptr default_POA) |
Create the Channel Factory. | |
virtual void | remove (TAO_Notify_EventChannelFactory *ecf) |
Called by the factory when it is destroyed. | |
Protected Member Functions | |
virtual void | init_i (CORBA::ORB_ptr orb) |
Init the data members. | |
Private Member Functions | |
virtual TAO_Notify_Factory * | create_factory () |
Create the Factory for Notify objects. | |
virtual TAO_Notify_Builder * | create_builder () |
Create the Builder for Notify objects. | |
void | set_threads (CosNotification::QoSProperties &qos, int threads) |
Set thread options on . | |
TAO_Notify_Factory & | factory () |
TAO_Notify_Builder & | builder () |
Service component for building NS participants. | |
Private Attributes | |
ACE_Auto_Ptr< TAO_Notify_Factory > | factory_ |
Service component for object factory operations. | |
ACE_Auto_Ptr< TAO_Notify_Builder > | builder_ |
Service component for building NS participants. |
Definition at line 37 of file CosNotify_Service.h.
|
Constuctor.
Definition at line 20 of file CosNotify_Service.cpp.
00021 { 00022 } |
|
Destructor.
Definition at line 24 of file CosNotify_Service.cpp.
00025 { 00026 } |
|
Service component for building NS participants.
Definition at line 284 of file CosNotify_Service.cpp. References ACE_ASSERT, and builder_. Referenced by create(), and create_builder().
00285 { 00286 ACE_ASSERT( this->builder_.get() != 0 ); 00287 return *this->builder_; 00288 } |
|
Create the Channel Factory.
Implements TAO_Notify_Service. Definition at line 265 of file CosNotify_Service.cpp. References ACE_ENV_ARG_PARAMETER, TAO_Notify_Builder::build_event_channel_factory(), and builder().
00266 { 00267 return this->builder().build_event_channel_factory (poa ACE_ENV_ARG_PARAMETER); 00268 } |
|
Create the Builder for Notify objects.
Reimplemented in TAO_RT_Notify_Service. Definition at line 253 of file CosNotify_Service.cpp. References ACE_CHECK_RETURN, ACE_NEW_THROW_EX, and builder().
00254 { 00255 TAO_Notify_Builder* builder = 0; 00256 ACE_NEW_THROW_EX (builder, 00257 TAO_Notify_Builder (), 00258 CORBA::NO_MEMORY ()); 00259 ACE_CHECK_RETURN (0); 00260 00261 return builder; 00262 } |
|
Create the Factory for Notify objects.
Reimplemented in TAO_RT_Notify_Service. Definition at line 239 of file CosNotify_Service.cpp. References ACE_CHECK_RETURN, ACE_NEW_THROW_EX, and ACE_Dynamic_Service< TYPE >::instance().
00240 { 00241 TAO_Notify_Factory* factory = ACE_Dynamic_Service<TAO_Notify_Factory>::instance ("TAO_Notify_Factory"); 00242 if (factory == 0) 00243 { 00244 ACE_NEW_THROW_EX (factory, 00245 TAO_Notify_Default_Factory (), 00246 CORBA::NO_MEMORY ()); 00247 ACE_CHECK_RETURN (0); 00248 } 00249 return factory; 00250 } |
|
Definition at line 277 of file CosNotify_Service.cpp. References ACE_ASSERT.
00278 { 00279 ACE_ASSERT( this->factory_.get() != 0 ); 00280 return *this->factory_; 00281 } |
|
Reimplemented from ACE_Shared_Object. Definition at line 191 of file CosNotify_Service.cpp.
00192 {
00193 return 0;
00194 }
|
|
Init the service from configurator.
Implements TAO_Notify_Service. Definition at line 29 of file CosNotify_Service.cpp. References ACE_Arg_Shifter, ACE_DEBUG, ACE_ERROR, ACE_TCHAR, ACE_TEXT, TAO_Notify_Properties::asynch_updates(), ACE_OS::atoi(), TAO_Notify_Properties::default_consumer_admin_qos_properties(), TAO_Notify_Properties::default_event_channel_qos_properties(), TAO_Notify_Properties::default_proxy_consumer_qos_properties(), TAO_Notify_Properties::default_proxy_supplier_qos_properties(), TAO_Notify_Properties::default_supplier_admin_qos_properties(), TAO_Singleton< TYPE, ACE_LOCK >::instance(), LM_DEBUG, LM_ERROR, CosNotification::QoSProperties, set_threads(), and TAO_Notify_Properties::updates().
00030 { 00031 ACE_Arg_Shifter arg_shifter (argc, argv); 00032 00033 const ACE_TCHAR *current_arg = 0; 00034 00035 // Default to an all reactive system. 00036 int ec_threads = 0; 00037 int consumer_threads = 0; 00038 int supplier_threads = 0; 00039 00040 int task_per_proxy = 0; 00041 00042 TAO_Notify_Properties *properties = TAO_Notify_PROPERTIES::instance(); 00043 00044 while (arg_shifter.is_anything_left ()) 00045 { 00046 if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-MTDispatching")) == 0) 00047 { 00048 arg_shifter.consume_arg (); 00049 ACE_DEBUG ((LM_DEBUG, 00050 ACE_TEXT ("(%P|%t) The -MTDispatching option has been deprecated, use -DispatchingThreads \n"))); 00051 } 00052 else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-DispatchingThreads")))) 00053 { 00054 consumer_threads += ACE_OS::atoi (current_arg); 00055 arg_shifter.consume_arg (); 00056 } 00057 else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-MTSourceEval")) == 0) 00058 { 00059 arg_shifter.consume_arg (); 00060 ACE_DEBUG ((LM_DEBUG, 00061 ACE_TEXT ("(%P|%t) The -MTSourceEval option has been deprecated, use -SourceThreads \n"))); 00062 } 00063 else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-SourceThreads")))) 00064 { 00065 supplier_threads += ACE_OS::atoi (current_arg); 00066 arg_shifter.consume_arg (); 00067 } 00068 else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-MTLookup")) == 0) 00069 { 00070 arg_shifter.consume_arg (); 00071 ACE_DEBUG ((LM_DEBUG, 00072 ACE_TEXT ("(%P|%t) The -MTLookup option has been deprecated, use -SourceThreads \n"))); 00073 } 00074 else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-LookupThreads")))) 00075 { 00076 supplier_threads += ACE_OS::atoi (current_arg); 00077 arg_shifter.consume_arg (); 00078 ACE_DEBUG ((LM_DEBUG, 00079 ACE_TEXT ("(%P|%t) The -LookupThreads option has been deprecated, use -SourceThreads \n"))); 00080 } 00081 else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-MTListenerEval")) == 0) 00082 { 00083 arg_shifter.consume_arg (); 00084 ACE_DEBUG ((LM_DEBUG, 00085 ACE_TEXT ("(%P|%t) The -MTListenerEval option has been deprecated, use -DispatchingThreads \n"))); 00086 } 00087 else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-ListenerThreads")))) 00088 { 00089 // Since this option is always added to consumer_threads, we'll 00090 // deprecate it in favor of that option. 00091 ACE_DEBUG ((LM_DEBUG, 00092 ACE_TEXT ("(%P|%t) The -ListenerThreads option has been deprecated, use -DispatchingThreads \n"))); 00093 consumer_threads += ACE_OS::atoi (current_arg); 00094 arg_shifter.consume_arg (); 00095 } 00096 else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-AsynchUpdates")) == 0) 00097 { 00098 arg_shifter.consume_arg (); 00099 00100 properties->asynch_updates (1); 00101 } 00102 else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-NoUpdates")) == 0) 00103 { 00104 arg_shifter.consume_arg (); 00105 00106 properties->updates (0); 00107 } 00108 else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-AllocateTaskperProxy")) == 0) 00109 { 00110 task_per_proxy = 1; 00111 arg_shifter.consume_arg (); 00112 } 00113 else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-AllowReconnect")) == 0) 00114 { 00115 arg_shifter.consume_arg (); 00116 TAO_Notify_PROPERTIES::instance()->allow_reconnect (true); 00117 } 00118 else 00119 { 00120 ACE_ERROR ((LM_ERROR, 00121 ACE_TEXT ("(%P|%t) Ignoring unknown option for Notify Factory: %s\n"), 00122 arg_shifter.get_current() 00123 )); 00124 arg_shifter.consume_arg (); 00125 } 00126 } 00127 00128 // Init the EC QoS 00129 { 00130 CosNotification::QoSProperties qos; 00131 this->set_threads (qos, ec_threads); 00132 properties->default_event_channel_qos_properties (qos); 00133 } 00134 00135 if (task_per_proxy == 0) 00136 { 00137 // Set the per ConsumerAdmin QoS 00138 { 00139 if (consumer_threads > 0) 00140 ACE_DEBUG((LM_DEBUG, "Using %d threads for each ConsumerAdmin.\n", consumer_threads)); 00141 CosNotification::QoSProperties qos; 00142 this->set_threads (qos, consumer_threads); 00143 properties->default_consumer_admin_qos_properties (qos); 00144 } 00145 00146 // Set the per SupplierAdmin QoS 00147 { 00148 if (supplier_threads > 0) 00149 ACE_DEBUG((LM_DEBUG, "Using %d threads for each SupplierAdmin.\n", supplier_threads)); 00150 CosNotification::QoSProperties qos; 00151 this->set_threads (qos, supplier_threads); 00152 properties->default_supplier_admin_qos_properties (qos); 00153 } 00154 } 00155 else 00156 { 00157 // Set the per ProxyConsumer QoS 00158 { 00159 if (supplier_threads > 0) 00160 ACE_DEBUG((LM_DEBUG, "Using %d threads for each Supplier.\n", supplier_threads)); 00161 CosNotification::QoSProperties qos; 00162 this->set_threads (qos, supplier_threads); // lookup thread per proxy doesn't make sense. 00163 properties->default_proxy_consumer_qos_properties (qos); 00164 } 00165 00166 // Set the per ProxySupplier QoS 00167 { 00168 if (consumer_threads > 0) 00169 ACE_DEBUG((LM_DEBUG, "Using %d threads for each Consumer.\n", consumer_threads)); 00170 CosNotification::QoSProperties qos; 00171 this->set_threads (qos, consumer_threads); 00172 properties->default_proxy_supplier_qos_properties (qos); 00173 } 00174 } 00175 00176 return 0; 00177 } |
|
Init the data members. Set the properties Reimplemented in TAO_RT_Notify_Service. Definition at line 206 of file CosNotify_Service.cpp. References ACE_ASSERT, ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_ERROR, builder_, TAO_Notify_Properties::default_poa(), TAO_Singleton< TYPE, ACE_LOCK >::instance(), CORBA::is_nil(), LM_ERROR, TAO_Notify_Properties::orb(), and ACE_Auto_Basic_Ptr< X >::reset(). Referenced by TAO_RT_Notify_Service::init_i(), and init_service().
00207 { 00208 // Obtain the Root POA 00209 CORBA::Object_var object = 00210 orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); 00211 ACE_CHECK; 00212 00213 if (CORBA::is_nil (object.in ())) 00214 ACE_ERROR ((LM_ERROR, 00215 " (%P|%t) Unable to resolve the RootPOA.\n")); 00216 00217 PortableServer::POA_var default_poa = PortableServer::POA::_narrow (object.in () ACE_ENV_ARG_PARAMETER); 00218 ACE_CHECK; 00219 00220 /// Set the properties 00221 TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance(); 00222 00223 properties->orb (orb); 00224 properties->default_poa (default_poa.in ()); 00225 00226 // Init the factory 00227 this->factory_.reset (this->create_factory (ACE_ENV_SINGLE_ARG_PARAMETER)); 00228 ACE_CHECK; 00229 ACE_ASSERT( this->factory_.get() != 0 ); 00230 TAO_Notify_PROPERTIES::instance()->factory (this->factory_.get()); 00231 00232 this->builder_.reset (this->create_builder (ACE_ENV_SINGLE_ARG_PARAMETER)); 00233 ACE_CHECK; 00234 ACE_ASSERT( this->builder_.get() != 0 ); 00235 TAO_Notify_PROPERTIES::instance()->builder (this->builder_.get()); 00236 } |
|
Init the service from driver.
Implements TAO_Notify_Service. Reimplemented in TAO_RT_Notify_Service. Definition at line 197 of file CosNotify_Service.cpp. References ACE_CHECK, ACE_DEBUG, ACE_ENV_ARG_PARAMETER, init_i(), and LM_DEBUG.
|
|
Called by the factory when it is destroyed.
Definition at line 271 of file CosNotify_Service.cpp.
00272 {
00273 // NOP.
00274 }
|
|
Set thread options on .
Definition at line 180 of file CosNotify_Service.cpp. References CosNotification::QoSProperties, and CORBA::string_dup(). Referenced by init().
00181 { 00182 NotifyExt::ThreadPoolParams tp_params = 00183 {NotifyExt::CLIENT_PROPAGATED, 0, 0, (unsigned)threads, 0, 0, 0, 0, 0 }; 00184 00185 qos.length (1); 00186 qos[0].name = CORBA::string_dup (NotifyExt::ThreadPool); 00187 qos[0].value <<= tp_params; 00188 } |
|
Service component for building NS participants.
Definition at line 84 of file CosNotify_Service.h. |
|
Service component for object factory operations.
Definition at line 81 of file CosNotify_Service.h. |