TAO::ORB Namespace Reference


Functions

void init_orb_globals ()
int open_services (ACE_Service_Gestalt *cfg, int &argc, ACE_TCHAR **argv)
int close_services (ACE_Service_Gestalt *pcfg)
void default_svc_conf_entries (char const *rf_args, char const *ssf_args, char const *csf_args)


Function Documentation

int TAO::ORB::close_services ACE_Service_Gestalt pcfg  ) 
 

The complement to open_services(), this will perform appropriate ACE Service Configurator closure operations. It should be called as many times as open_services(), and will only actually close things down on the last call. It is fully thread-safe.

Returns:
0 if successful, -1 with errno set if failure.

Definition at line 408 of file TAO_Internal.cpp.

References ACE_GUARD_RETURN, ACE_Service_Gestalt::close(), service_open_count, and TAO_SYNCH_RECURSIVE_MUTEX.

Referenced by TAO_ORB_Core::fini().

00409 {
00410   ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00411                             guard,
00412                             *ACE_Static_Object_Lock::instance (),
00413                             -1));
00414   service_open_count--;
00415 
00416   return pcfg->close ();
00417 }

void TAO::ORB::default_svc_conf_entries char const *  rf_args,
char const *  ssf_args,
char const *  csf_args
 

Set default `svc.conf' content. This function must be called before first ORB initialization.

Definition at line 420 of file TAO_Internal.cpp.

References client_strategy_factory_args, resource_factory_args, and server_strategy_factory_args.

00423 {
00424   resource_factory_args        = rf_args;
00425   server_strategy_factory_args = ssf_args;
00426   client_strategy_factory_args = csf_args;
00427 }

void TAO::ORB::init_orb_globals  ) 
 

Initialize the ORB globals correctly, i.e., only when they haven't been initialized yet.

Note:
The new TypeCode implementation obviates the above comment. Standard CORBA exception TypeCodes are now available before CORBA::ORB_init() is ever called.

Definition at line 1276 of file ORB.cpp.

References TAO_Singleton_Manager::_set_unexpected(), TAO_Singleton_Manager::instance(), orb_init_count, and TAO_unexpected_exception_handler().

Referenced by CORBA::ORB_init(), and PortableInterceptor::register_orb_initializer().

01277 {
01278   // This method should be invoked atomically.  It is the caller's
01279   // responsibility to ensure that this condition is satisfied.
01280 
01281   // Prevent multiple initializations.
01282   if (orb_init_count != 0)
01283     {
01284       return;
01285     }
01286   else
01287     {
01288       ++orb_init_count;
01289     }
01290 
01291   // This must be done after the system TypeCodes and Exceptions have
01292   // been initialized.  An unexpected exception will cause TAO's
01293   // unexpected exception handler to be called.  That handler
01294   // transforms all unexpected exceptions to CORBA::UNKNOWN, which of
01295   // course requires the TypeCode constants and system exceptions to
01296   // have been initialized.
01297   /**
01298    * @note The new TypeCode implementation obviates the above
01299    *       comment.  Standard CORBA exception TypeCodes are now
01300    *       available before CORBA::ORB_init() is ever called.
01301    */
01302   TAO_Singleton_Manager::instance ()->_set_unexpected (
01303     ::TAO_unexpected_exception_handler);
01304 }

int TAO::ORB::open_services ACE_Service_Gestalt cfg,
int &  argc,
ACE_TCHAR **  argv
 

Extract ACE Service Configurator arguments from the given argument vector, and initialize the ACE Service Configurator.

Note:
This method should be called before the ORB Core is initialized, and before any ORBInitializers are invoked.

Definition at line 198 of file TAO_Internal.cpp.

References ACE_CString, ACE_DEBUG, ACE_ERROR_RETURN, ACE_GUARD_RETURN, ACE_TEXT, ACE_TEXT_ALWAYS_CHAR, TAO::details::unbounded_basic_string_sequence< char >::get_buffer(), ACE_Service_Config::global(), is_ubergestalt_ready, TAO::details::unbounded_basic_string_sequence< char >::length(), LM_DEBUG, open_private_services_i(), parse_global_args_i(), parse_private_args_i(), parse_svcconf_args_i(), register_additional_services_i(), register_global_services_i(), service_open_count, TAO_debug_level, and TAO_SYNCH_RECURSIVE_MUTEX.

Referenced by CORBA::ORB_init().

00201 {
00202   {
00203     ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00204                               guard,
00205                               TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
00206                               -1));
00207 
00208     // Wait in line, while the default ORB (which isn't us) completes
00209     // initialization of the globaly reuired service objects
00210     if (service_open_count == 1)
00211       {
00212         if (TAO_debug_level > 4)
00213           ACE_DEBUG ((LM_DEBUG,
00214                       ACE_TEXT ("TAO (%P|%t) Waiting for the default ")
00215                       ACE_TEXT ("ORB to complete the global ")
00216                       ACE_TEXT ("initialization\n")));
00217 
00218         ACE_MT (while (!is_ubergestalt_ready)
00219                 TAO_Ubergestalt_Ready_Condition::instance ()->wait ());
00220 
00221         if (TAO_debug_level > 4)
00222           ACE_DEBUG ((LM_DEBUG,
00223                       ACE_TEXT ("TAO (%P|%t) The default ")
00224                       ACE_TEXT ("ORB must have completed the global ")
00225                       ACE_TEXT ("initialization...\n")));
00226 
00227       }
00228     else
00229       {
00230         if (TAO_debug_level > 4)
00231           ACE_DEBUG ((LM_DEBUG,
00232                       ACE_TEXT ("TAO (%P|%t) We are %sthe default ")
00233                       ACE_TEXT ("ORB ...\n"),
00234                       (service_open_count == 0) ? "" : "not "));
00235       }
00236 
00237     service_open_count++;
00238   }
00239 
00240   // Construct an argument vector specific to the Service
00241   // Configurator.
00242   CORBA::StringSeq svc_config_argv;
00243 
00244   // Be certain to copy the program name so that service configurator
00245   // has something to skip!
00246   ACE_CString argv0 ("");
00247 
00248   if (argc > 0 && argv != 0)
00249     {
00250       argv0 = ACE_TEXT_ALWAYS_CHAR (argv[0]);
00251     }
00252 
00253   svc_config_argv.length (1);
00254   svc_config_argv[0] = argv0.c_str ();
00255 
00256   // Should we skip the ACE_Service_Config::open() method, e.g., if we
00257   // already being configured by the ACE Service Configurator.
00258   //
00259   // @@ This is no longer needed since the Service Configurator is now
00260   // reentrant.(-Ossama)
00261   // @@ Leaving it in, since the -ORBSkipServiceConfigOpen is still
00262   // available. (-Iliyan)
00263   bool skip_service_config_open = false;
00264 
00265   // Extract any ORB options from the argument vector.
00266   if (parse_private_args_i (argc,
00267                             argv,
00268                             svc_config_argv,
00269                             skip_service_config_open) == -1)
00270     {
00271       return -1;
00272     }
00273 
00274   // Construct an argument vector specific to the process-wide
00275   // (global) Service Configurator instance.
00276   CORBA::StringSeq global_svc_config_argv;
00277 
00278   ACE_Service_Gestalt * theone = ACE_Service_Config::global ();
00279 
00280   if (service_open_count == 1)
00281     {
00282       ACE_Service_Config_Guard config_guard (theone);
00283 
00284       if (TAO_debug_level > 2)
00285         {
00286           ACE_DEBUG ((LM_DEBUG,
00287                       ACE_TEXT ("TAO (%P|%t) Initializing the ")
00288                       ACE_TEXT ("process-wide services\n")));
00289         }
00290 
00291       register_global_services_i (theone);
00292 
00293       // Be certain to copy the program name so that service configurator
00294       // has something to skip!
00295       ACE_CString argv0 ("");
00296 
00297       if (argc > 0 && argv != 0)
00298         {
00299           argv0 = ACE_TEXT_ALWAYS_CHAR (argv[0]);
00300         }
00301 
00302       global_svc_config_argv.length (1);
00303       global_svc_config_argv[0] = argv0.c_str ();
00304 
00305       if (parse_global_args_i (argc, argv, global_svc_config_argv, true) == -1)
00306         {
00307           return -1;
00308         }
00309 
00310       if (parse_svcconf_args_i (argc, argv, global_svc_config_argv) == -1)
00311         {
00312           return -1;
00313         }
00314 
00315       int global_svc_config_argc = global_svc_config_argv.length ();
00316       int status =
00317         open_private_services_i (theone,
00318                                  global_svc_config_argc,
00319                                  global_svc_config_argv.get_buffer (),
00320                                  skip_service_config_open);
00321 
00322       if (status == -1 && TAO_debug_level > 0)
00323         {
00324           if (TAO_debug_level > 0)
00325             {
00326               ACE_ERROR_RETURN ((LM_DEBUG,
00327                                  ACE_TEXT ("TAO (%P|%t) Failed to ")
00328                                  ACE_TEXT ("open process-wide service ")
00329                                  ACE_TEXT ("configuration\n")),
00330                                 -1);
00331             }
00332 
00333           return -1;
00334         }
00335 
00336       register_additional_services_i (theone);
00337 
00338 
00339       if (TAO_debug_level > 4)
00340         ACE_DEBUG ((LM_DEBUG,
00341                     ACE_TEXT ("TAO (%P|%t) Default ORB - global ")
00342                     ACE_TEXT ("initialization completed.\n")));
00343 
00344       // Notify all other threads that may be waiting, that the global
00345       // gestalt has been initialized.
00346       {
00347         ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00348                                   guard,
00349                                   TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
00350                                   -1));
00351 
00352         is_ubergestalt_ready = true;
00353         ACE_MT (if (TAO_Ubergestalt_Ready_Condition::instance ()->
00354                     broadcast () == -1)
00355                 return -1);
00356       }
00357 
00358     }
00359   else
00360     {
00361       int status =
00362         parse_global_args_i(argc, argv,global_svc_config_argv, false);
00363       if (status == -1 && TAO_debug_level > 0)
00364         ACE_DEBUG ((LM_DEBUG,
00365                     ACE_TEXT ("TAO (%P|%t) Skipping the process-wide ")
00366                     ACE_TEXT ("service configuration, service_open_count ")
00367                     ACE_TEXT ("= %d, status = %d\n"),
00368                     service_open_count,
00369                     status));
00370     }
00371 
00372   if (TAO_debug_level > 2)
00373     {
00374       ACE_DEBUG ((LM_DEBUG,
00375                   ACE_TEXT ("TAO (%P|%t) Initializing the ")
00376                   ACE_TEXT ("orb-specific services\n")));
00377     }
00378 
00379   if (parse_svcconf_args_i (argc, argv, svc_config_argv) == -1)
00380     {
00381       return -1;
00382     }
00383 
00384   int svc_config_argc = svc_config_argv.length ();
00385   int status =
00386     open_private_services_i (pcfg,
00387                              svc_config_argc,
00388                              svc_config_argv.get_buffer (),
00389                              skip_service_config_open);
00390 
00391   if (status >= 0)
00392     {
00393       return 0;
00394     }
00395 
00396   if (TAO_debug_level > 0)
00397     {
00398       ACE_ERROR_RETURN ((LM_DEBUG,
00399                          ACE_TEXT ("TAO (%P|%t) Failed to ")
00400                          ACE_TEXT ("open orb service configuration\n")),
00401                         -1);
00402     }
00403 
00404   return -1;
00405 }


Generated on Thu Nov 9 12:27:44 2006 for TAO by doxygen 1.3.6